草庐IT

fcatch-undefined-behavior

全部标签

c++ - 链接错误 "undefined reference to ` __gxx_personality_v 0'"和 g++

这个问题在这里已经有了答案:关闭11年前.PossibleDuplicate:UndefinedSymbol___gxx_personality_v0onlink我对以下程序有疑问。//fkt.cpp#include"fkt.h"intadd2(inta,intb){returna+b;}还有标题://fkt.hintadd2(inta,intb);现在我编译这个:g++-cfkt.cpp现在我运行nm并得到:00000000T_Z6add2iiU__gxx_personality_v0当我想在任何地方使用该功能时:(.eh_frame+0x12):undefinedreference

c++ - GCC C++ 链接器错误 : Undefined reference to 'vtable for XXX' , 对 'ClassName::ClassName()' 的 undefined reference

我正在使用Eclipse-CDT在Ubuntux64上设置C++项目。我基本上是在打个招呼,并链接到一个商业3rd方库。我已经包含了头文件,链接到他们的库,但我仍然遇到链接器错误。除了明显的问题之外,这里是否还有一些可能的问题(例如,我99%确定我正在链接到正确的库)。有没有办法确认我链接的静态库是64位的?有没有办法确认该库具有我期望它具有的类(和方法)?Eclipse说:Buildingtarget:LinkProblemInvoking:GCCC++Linkerg++-L/home/notroot/workspace/somelib-3/somelib/target/bin-o"

c++ - 对静态 const int 的 undefined reference

我今天遇到了一个有趣的问题。考虑这个简单的例子:templatevoidfoo(constT&a){/*code*/}//Thiswouldalsofail//voidfoo(constint&a){/*code*/}classBar{public:staticconstintkConst=1;voidfunc(){foo(kConst);//Thisistheimportantline}};intmain(){Barb;b.func();}编译时出现错误:Undefinedreferenceto'Bar::kConst'现在,我很确定这是因为staticconstint没有在任何地方

C++ Boost:对 boost::system::generic_category() 的 undefined reference

我正在尝试包含Boost我项目中的库,并且一直面临同样的问题。我在带有CodeblocksIDE的Ubuntu12.10上,并尝试手动安装库,从站点读取说明,但在header和使用前构建的库中出现错误。然后我通过终端通过sudoapt-getinstalllibboost-all-dev安装了库.之后,在我的代码块程序中,我可以包含像#include这样的标题。但是当我尝试包含文件系统库的header(#include"boost/filesystem/operations.hpp")时,我收到以下错误:/usr/include/boost/system/error_code.hpp|

c++ - "Undefined Behavior"真的允许*任何事情*发生吗?

这个问题在这里已经有了答案:Undefined,unspecifiedandimplementation-definedbehavior(9个回答)关闭7年前。“未定义行为”的经典杜撰示例当然是“鼻恶魔”——无论C和C++标准允许什么,在物理上都是不可能的。因为C和C++社区倾向于强调未定义行为的不可预测性以及允许编译器在遇到未定义行为时使程序按字面意思执行任何事情的想法,我曾假设该标准对未定义行为的行为没有任何限制。但是relevantquoteintheC++standardseemstobe:[C++14:defns.undefined]:[..]Permissibleundef

c++ - 对静态变量的 undefined reference

这个问题在这里已经有了答案:关闭9年前。PossibleDuplicate:C++:undefinedreferencetostaticclassmember我正在使用MinGW。为什么静态变量不起作用[Linkererror]undefinedreferenceto`A::i'#includeclassA{public:staticinti;staticintinit(){i=1;}};intWINAPIWinMain(HINSTANCEhThisInstance,HINSTANCEhPrevInstance,LPSTRlpszArgument,intnFunsterStil){A:

c++ - 对静态变量的 undefined reference

这个问题在这里已经有了答案:关闭9年前。PossibleDuplicate:C++:undefinedreferencetostaticclassmember我正在使用MinGW。为什么静态变量不起作用[Linkererror]undefinedreferenceto`A::i'#includeclassA{public:staticinti;staticintinit(){i=1;}};intWINAPIWinMain(HINSTANCEhThisInstance,HINSTANCEhPrevInstance,LPSTRlpszArgument,intnFunsterStil){A:

php - PHP 错误消息 "Notice: Use of undefined constant"是什么意思?

PHP正在日志中写入此错误:“注意:使用未定义的常量”。日志错误:PHPNotice:Useofundefinedconstantdepartment-assumed'department'(line5)PHPNotice:Useofundefinedconstantname-assumed'name'(line6)PHPNotice:Useofundefinedconstantemail-assumed'email'(line7)PHPNotice:Useofundefinedconstantmessage-assumed'message'(line8)相关代码行:$departme

php - 引用 : What is variable scope, 哪些变量可以从哪里访问,什么是 "undefined variable"错误?

Note:ThisisareferencequestionfordealingwithvariablescopeinPHP.Pleasecloseanyofthemanyquestionsfittingthispatternasaduplicateofthisone.PHP中的“变量范围”是什么?一个.php文件中的变量是否可以在另一个文件中访问?为什么我有时会收到“undefinedvariable”错误? 最佳答案 什么是“可变范围”?变量具有有限的“范围”或“可访问的位置”。就因为你写了$foo='bar';一旦在您的应用程序

c++ - Linux c++错误: undefined reference to 'dlopen'

我使用C++(Eclipse)在Linux中工作,并且想使用一个库。Eclipse显示错误:undefinedreferenceto'dlopen'您知道解决方案吗?这是我的代码:#include#include#includeintmain(intargc,char**argv){void*handle;double(*desk)(char*);char*error;handle=dlopen("/lib/CEDD_LIB.so.6",RTLD_LAZY);if(!handle){fputs(dlerror(),stderr);exit(1);}desk=dlsym(handle,"