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

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

    1. <legend id='n0err'><style id='n0err'><dir id='n0err'><q id='n0err'></q></dir></style></legend>
        <bdo id='n0err'></bdo><ul id='n0err'></ul>
      <tfoot id='n0err'></tfoot>
    2. C++:警告:C4930:未调用原型函数(是否打算定义变量?)

      C++: warning: C4930: prototyped function not called (was a variable definition intended?)(C++:警告:C4930:未调用原型函数(是否打算定义变量?))

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

                <bdo id='fPyxD'></bdo><ul id='fPyxD'></ul>
                  <tbody id='fPyxD'></tbody>

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

              • 本文介绍了C++:警告:C4930:未调用原型函数(是否打算定义变量?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个没有默认构造函数的类,我创建了一个变量而没有错误地提供参数,但不是一个很好的编译器错误,而是一个链接器错误,我不能't 找到导致它的代码行.

                I have a class that does not have a default constructor, I created a variable without giving parameters by mistake, but instead of a nice compiler error, I got a linker error, where I couldn't find the line of code that was causing it.

                最后,我设法找到了导致这种情况的代码,直到那时我才注意到我收到了这个警告:

                In the end, I managed to find the code that caused this, and only then I noticed that I was getting this warning:

                C++: warning: C4930: prototyped function not called (was a variable definition intended?)
                

                奇怪的是当我更改代码时:

                What's weird is when I changed the code from:

                MyClass foo();
                

                MyClass foo;
                

                我确实遇到了编译器错误.

                I did get a compiler error.

                谁能给我解释一下为什么编译器突然开始奇怪了,是bug还是什么?

                Can someone explain to me why the compiler suddenly started acting strange, is it a bug or something?

                推荐答案

                这个

                MyClass foo();
                

                是返回类型为 MyClass 且不接受参数的函数声明..

                is a function declaration that has return type MyClass and does not accept arguments..

                这个

                MyClass foo;
                

                是一个对象定义.由于您的类 MyClass 没有默认构造函数,因此编译器会发出错误.

                is an object definition. As your class MyClass has no the default constructor the compiler issues an error.

                这篇关于C++:警告:C4930:未调用原型函数(是否打算定义变量?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                C++ stl unordered_map implementation, reference validity(C++ stl unordered_map 实现,参考有效性)
                C++: Is it possible to use a reference as the value in a map?(C++:是否可以使用引用作为映射中的值?)
                Where ampersand quot;amp;quot; can be put when passing argument by reference?(其中符号“amp;通过引用传递参数时可以放置吗?)
                Why can a non-const reference parameter be bound to a temporary object?(为什么可以将非常量引用参数绑定到临时对象?)
                What is a dangling reference?(什么是悬空引用?)
                C++ reference changes when push_back new element to std::vector(当 push_back 新元素到 std::vector 时,C++ 引用发生变化)
                <legend id='I6o93'><style id='I6o93'><dir id='I6o93'><q id='I6o93'></q></dir></style></legend>
                  <tbody id='I6o93'></tbody>
                • <bdo id='I6o93'></bdo><ul id='I6o93'></ul>

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

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