草庐IT

fcatch-undefined-behavior

全部标签

c++ - 对 vkCreateInstance 的 undefined reference

最终编辑:这是TDM_GCC的编译器/链接器错误。查看答案。编辑:据我所知,这不是重复的。这个问题似乎是一个简单的菜鸟错误,但事实并非如此。我已经使用TDM-GCC-64(Windows的GCC/MinGW工具包)链接到正确的Vulkan库“vulkan-1.lib”,并使用了VulkanSDK示例中的示例代码。本页HowdoIuseVulkanwithMinGW?(R_X86_64_32error)还确认它可以在MinGW上运行,这应该与TDM-GCC-64没有什么不同,因为它使用了MinGW的一部分。如果这是一个简单答案的重复,那么我很抱歉提出这个问题,但到目前为止还没有人解决这个

C++ 在使用 .o 和使用 .a 文件链接之间存在差异 : different behavior, 为什么?

我预计:linkingwith.ofile,andlinkingwith.afilearchivedfromthe.ofile,shouldhavenodifference.但事实并非如此。我有2个源文件,每个都声明1class+1staticobject+1函数,以及一个调用其中一个函数的main.cpp$catFirst.cpp#includestructFirst{First(){printf("First\n");}};voidf1(){printf("f1\n");}//NotcalledinmainstaticFirstf_obj;$catSecond.cpp#includ

c++ - 对 `cv::Stitcher::createDefault(bool)' 的 undefined reference

我尝试在c++中使用opencv拼接图像,当程序编译时,它抛出错误Stitcherstitcher=Stitcher::createDefault();undefinedreferenceto`cv::Stitcher::createDefault(bool)'为了Stitcher::Statusstatus=stitcher.stitch(vImg,rImg);undefinedreferenceto`cv::Stitcher::stitch(cv::_InputArrayconst&,cv::_OutputArrayconst&)'请帮我解决这个错误。在此先感谢您。

c++ - 带有 C++ 模板的 SWIG : undefined symbol

C++模板和SWIG不能很好地结合在一起。当我尝试导入我的模块时出现错误ImportError:./_simple.so:undefinedsymbol:_Z9double_itIiET_S0_我正在使用SWIG1.3。这是一个简单的例子来说明问题://file:simple.htemplateTdouble_it(Ta);//file:simple.cctemplateTdouble_it(Ta){return(2*a);}//file:simple.i%module"simple"%{#include"simple.h"%}%include"simple.h"%template(i

c++ - Matlab Engine 命令窗口中的 "??? Undefined function or method"

我正在使用VisualStudio编写C++代码,并将一些变量发送到MATLAB引擎。到目前为止没有问题。假设我打开了MATLAB命令窗口并且这些变量:»whosNameSizeBytesClassAttributesQWe1x3652920doubleQWp1x3642912doubleQWu1x3642912double我可以使用标准的MATLAB函数,但我下载了一个新的function.m(设置路径后它在MATLAB中正常工作),MATLAB引擎的命令窗口无法识别或找到它。»isnormq(Q)???Undefinedfunctionormethod'isnormq'我以为它们(

c++ - 错误 : Undefined symbols for architecture x86_64 with classes

我是一名初学者,正在编写一个帮助我节食的有趣程序。该程序尚未完成,但在我编写时正在编译。我不断收到标题中提到的错误:Undefinedsymbolsforarchitecturex86_64withclasses我看过类似的问题,但它们都与模板和继承类有关,这与我的情况不同。我只是在宣布一个类(class),没什么特别的。我认为这与未正确定义类有关,但我无法弄清楚它是什么。这可能是我想念的愚蠢的东西,但我仍然被困住了。谢谢。#include#includeusingnamespacestd;classMeal{private:stringname;intprotein;intcarbs

C++11,枚举类,g++ 的 undefined reference ,与 clang++ 一起工作

我使用了新的C++11“枚举类”类型,并在使用g++时观察到“undefinedreference”问题。这个问题不会发生在clang++中。我不知道是我做错了什么还是g++错误。重现问题的代码是:(4个文件:enum.hpp、enum.cpp、main.cpp和Makefile)//file:enum.hppenumclassMyEnum{val_1,val_2};templatestructFoo{staticconstMyEnumvalue=MyEnum::val_1;};templatestructFoo{staticconstMyEnumvalue=MyEnum::val_2

c++ - 英特尔编译器 - 错误 : identifier "alignof" is undefined

我正在尝试运行alignof运算符的示例。#includestructEmpty{};structFoo{intf2;floatf1;charc;};intmain(){std::cout当我用gcc(g++-std=c++11alignof.cpp)编译它时,我没有得到任何错误。但是当我用icc(icpc-std=c++11alignof.cpp)编译它时,我得到以下错误,我不知道为什么:cenas.cpp(13):error:typenameisnotallowedstd::cout我在同一台机器上运行代码,并使用module命令更改编译器。alignof运算符怎么可能未定义?

c++ - 升级到 OS X Mavericks 后架构 x86_64 的 OpenCV undefined symbol

我有一个运行良好的opencv项目。今天我已经将我的OSXlion升级到Maverick,我收到以下imwrite函数的错误:Undefinedsymbolsforarchitecturex86_64:"cv::imwrite(std::__1::basic_string,std::__1::allocator>const&,cv::_InputArrayconst&,std::__1::vector>const&)",referencedfrom:_maininHello.old:symbol(s)notfoundforarchitecturex86_64我不得不说其他opencv函

c++ - 对 'cv::viz::Viz3d::Viz3d(std::string&const)' 的 undefined reference

我已经使用qtcreator运行了我的opencv代码,当我尝试使用Viz库时得到了这个答案。代码:#include#include#include#include#include///Createawindowviz::Viz3dmyWindow("VizDemo");///StarteventloopmyWindow.spin();///Eventloopisoverwhenpressedq,Q,e,Eprintf("Firsteventloopisover\n");///Accesswindowviaitsnameviz::Viz3dsameWindow=viz::getWind