编译 c++ 时出错带有 g++ 的代码
我收到此类错误:
“在函数中...的多重定义”
“...首先在这里定义”
“警告:符号大小...在“
*代码使用以下标志编译:-ansi -Wall -pedantic-errors -Werror
*使用STL
对此有什么解释吗?
先感谢您
i get error of this type:
"in function ... multiple definition of ..."
"... first defined here"
"warning: size of symbol ... changed from to in "
*the code is compiled with the flags: -ansi -Wall -pedantic-errors -Werror
*STL is used
is there any explanation for that?
thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解释?您引用的错误消息已经是尽可能详尽的解释。某些东西(变量)在同一范围内被定义多次。编译器为您提供了有问题的变量的名称。编译器在第二个定义处报告了错误,并提供了一条指出第一个定义的附加消息。这就是您查找问题所需了解的全部内容。这里还要解释什么?
Explanation? The error message you quoted is already an explanation as exhaustive as it can ever get. Something (a variable) is defined more than once in the same scope. The compiler gave you the name of the offending variable. The compiler reported the error at the second definition and supplied an additional message that points out the first definition. That's everything you need to know to find the problem and then some. What more to explain here?