• <bdo id='Fzil8'></bdo><ul id='Fzil8'></ul>

    <legend id='Fzil8'><style id='Fzil8'><dir id='Fzil8'><q id='Fzil8'></q></dir></style></legend>

      1. <small id='Fzil8'></small><noframes id='Fzil8'>

        <i id='Fzil8'><tr id='Fzil8'><dt id='Fzil8'><q id='Fzil8'><span id='Fzil8'><b id='Fzil8'><form id='Fzil8'><ins id='Fzil8'></ins><ul id='Fzil8'></ul><sub id='Fzil8'></sub></form><legend id='Fzil8'></legend><bdo id='Fzil8'><pre id='Fzil8'><center id='Fzil8'></center></pre></bdo></b><th id='Fzil8'></th></span></q></dt></tr></i><div id='Fzil8'><tfoot id='Fzil8'></tfoot><dl id='Fzil8'><fieldset id='Fzil8'></fieldset></dl></div>
      2. <tfoot id='Fzil8'></tfoot>

        C++ 中的额外限定错误

        时间:2023-10-18

              <i id='zCIP9'><tr id='zCIP9'><dt id='zCIP9'><q id='zCIP9'><span id='zCIP9'><b id='zCIP9'><form id='zCIP9'><ins id='zCIP9'></ins><ul id='zCIP9'></ul><sub id='zCIP9'></sub></form><legend id='zCIP9'></legend><bdo id='zCIP9'><pre id='zCIP9'><center id='zCIP9'></center></pre></bdo></b><th id='zCIP9'></th></span></q></dt></tr></i><div id='zCIP9'><tfoot id='zCIP9'></tfoot><dl id='zCIP9'><fieldset id='zCIP9'></fieldset></dl></div>

              <legend id='zCIP9'><style id='zCIP9'><dir id='zCIP9'><q id='zCIP9'></q></dir></style></legend>

              <small id='zCIP9'></small><noframes id='zCIP9'>

            • <tfoot id='zCIP9'></tfoot>
                <tbody id='zCIP9'></tbody>

              • <bdo id='zCIP9'></bdo><ul id='zCIP9'></ul>

                  本文介绍了C++ 中的额外限定错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个成员函数,定义如下:

                  Value JSONDeserializer::ParseValue(TDR 类型,const json_string& valueString);

                  当我编译源代码时,我得到:

                  <块引用>

                  错误:成员 'ParseValue' 上的额外限定 'JSONDeserializer::'

                  这是什么?如何消除此错误?

                  解决方案

                  这是因为您有以下代码:

                  class JSONDeserializer{值 JSONDeserializer::ParseValue(TDR 类型,const json_string& valueString);};

                  这不是有效的 C++,但 Visual Studio 似乎接受它.您需要将其更改为以下代码,才能使用符合标准的编译器进行编译(在这一点上 gcc 更符合标准).

                  class JSONDeserializer{值解析值(TDR 类型,const json_string& valueString);};

                  错误来自于JSONDeserializer::ParseValue 是一个限定名(具有命名空间限定的名称),并且这样的名称在类中被禁止作为方法名.>

                  I have a member function that is defined as follows:

                  Value JSONDeserializer::ParseValue(TDR type, const json_string& valueString);
                  

                  When I compile the source, I get:

                  error: extra qualification 'JSONDeserializer::' on member 'ParseValue'

                  What is this? How do I remove this error?

                  解决方案

                  This is because you have the following code:

                  class JSONDeserializer
                  {
                      Value JSONDeserializer::ParseValue(TDR type, const json_string& valueString);
                  };
                  

                  This is not valid C++ but Visual Studio seems to accept it. You need to change it to the following code to be able to compile it with a standard compliant compiler (gcc is more compliant to the standard on this point).

                  class JSONDeserializer
                  {
                      Value ParseValue(TDR type, const json_string& valueString);
                  };
                  

                  The error come from the fact that JSONDeserializer::ParseValue is a qualified name (a name with a namespace qualification), and such a name is forbidden as a method name in a class.

                  这篇关于C++ 中的额外限定错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:为什么不能“transform(s.begin(),s.end(),s.begin(),tolower)"?能 下一篇:如果函数在类范围内声明,则 constexpr 不起作用

                  相关文章

                1. <small id='zym0G'></small><noframes id='zym0G'>

                  <legend id='zym0G'><style id='zym0G'><dir id='zym0G'><q id='zym0G'></q></dir></style></legend>
                  <tfoot id='zym0G'></tfoot>

                      <bdo id='zym0G'></bdo><ul id='zym0G'></ul>

                    1. <i id='zym0G'><tr id='zym0G'><dt id='zym0G'><q id='zym0G'><span id='zym0G'><b id='zym0G'><form id='zym0G'><ins id='zym0G'></ins><ul id='zym0G'></ul><sub id='zym0G'></sub></form><legend id='zym0G'></legend><bdo id='zym0G'><pre id='zym0G'><center id='zym0G'></center></pre></bdo></b><th id='zym0G'></th></span></q></dt></tr></i><div id='zym0G'><tfoot id='zym0G'></tfoot><dl id='zym0G'><fieldset id='zym0G'></fieldset></dl></div>