草庐IT

undefined-index

全部标签

c++ - 为什么这个 get_index 实现在 VS2017 上失败了?

巴里给了我们thisgorgeousget_indexforvariants:templatestructtag{};templatestructget_index;templatestructget_index>:std::integral_constant...>(tag()).index()>{};按如下方式使用:usingV=variant;constexprconstsize_tN=get_index::value;//1它在Clang(OSX)中运行良好。但在VisualStudio2017中I'mgetting以下内容:(10):errorC2039:'index':is

c++ - 对模板的`vtable 的 undefined reference

我有一个继承自接口(interface)类的模板类,因此具有虚函数//abstract.hclassAbstract{virtualvoidabc();Abstract();}//Abstract.cppAbstract::Abstract(){//dosomeinit}//concrete.hclassImpl{public:voidabcImpl();};templateclassConcrete:publicAbstract,publicT{virtualvoidabc();};templateConcrete::abc(){static_cast(*this).abcImpl(

c++ - 针对 Automake 生成的库进行编译时 undefined reference

我在使用automake的项目中遇到一个非常奇怪的链接错误。从手册上看,我所做的似乎很简单,所以我真的很想知道我做错了什么......我的项目有三个文件夹:src/common,我把一些C++文件编译成一个libube-common.astaticlibsrc/engine,其中我将一些文件编译成一个libube-engine.astaticlibsrc/client,其中...你猜对了,libue-client.a,还有一个文件ube.cpp,它是我的main每个库都使用Makefile.am编译,如下所示:noinst_LIBRARIES=libube-common.alibube

c++ - 神秘的链接器错误 "undefined reference to ` __gxx_personality_v 0'"在 cygwin 中使用 clang

我做了一些搜索,所有答案似乎都建议使用clang++而不是clang(或者更确切地说是g++代替gcc),这就是我最初所做的。尽管如此,问题仍然存在,无论是clang++-Wall-std=c++11-otest.exetest.cppA.cppB.cppetc.cpp或clang++-lstdc++-Wall-std=c++11-otest.exetest.cppA.cppB.cppetc.cpp编译和链接在Cygwin中使用g++工作正常。g++-Wall-std=c++11-otest.exetest.cppA.cppB.cppetc.cpp更新:这是链接期间的信息。clang是

c++ - 休斯顿,我们有一个 undefined reference

MEGAEDIT3000我发现了undefinedreference的原因。我检查了我的.o文件中的符号,它们只是丢失了。只是不在那里。没有明显的原因。我已经检查了危害.o文件的来源,但似乎一切正常。我认为它可能是那些讨厌的#ifdef...#endifblock之一,像熊陷阱一样狡猾地隐藏在代码行中,等待它的受害者。但我找不到任何。将一些函数定义移动到文件的末尾并将它们包含在适用于Linux的#ifdef...#endifblock中后,符号神奇地出现了,一切都很好。感谢您的宝贵时间。Outdated,donotread.Ihavebeenassignedtoonebigprojec

【OpenCV】undefined reference to `cv::dnn::dnn4_v20191202::Net::~Net()‘

Linux环境下使用opencv的dnn模块调用yolov4遇到的坑(纯CPU)1.改CMakeList.txt向CMakeLists.txt中的find_package(OpenCV4REQUIREDopencv_coreopencv_imgprocopencv_highguiopencv_calib3dopencv_videoioopencv_imgcodecs)添加opencv_dnn,即改成find_package(OpenCV4REQUIREDopencv_coreopencv_imgprocopencv_highguiopencv_calib3dopencv_videoioopen

opencv - libopencv_calib3d : undefined reference to `std::__throw_out_of_range_fmt(char const*, …)@GLIBCXX_3.4.20'

我提到了this在我的RaspberryPi2上安装OpenCV(它运行在最新的Raspbian上,内核版本为4.1.7-v7)。由于依赖项错误,我无法安装libgtk2.0-dev,但我能够毫无错误地安装OpenCV。我正尝试在Qt中为我的RaspberryPi2交叉编译一些简单的OpenCV代码。但是我在链接器阶段遇到以下错误:/usr/local/lib/libopencv_calib3d.so:undefinedreferencetostd::__throw_out_of_range_fmt(charconst*,...)@GLIBCXX_3.4.20我的代码是:myFunc{

c++ - 为什么 -fsanitize=undefined 导致 "undefined reference to typeinfo"?

以下测试用例,从真实世界的应用程序中缩减而来,无法与-fsanitize=undefined链接(使用GCC6.1.1),但没有它也能正常链接。谁能告诉我为什么?似乎与Qt/QObject、-fvisibility=hidden、-fsanitize=undefined的组合有关,但问题到底出在哪里超越我。lib1.h:#includeclassMyObject:publicQObject{public:MyObject(QObject*parent=nullptr);~MyObject();voidmyMethod();};lib1.cc:#include"lib1.h"#defin

c++ - 错误 C2504 : 'BASECLASS' : base class undefined

我查看了一个与此类似的帖子,但链接不同,问题从未得到解决。我的问题是,出于某种原因,链接器期望有一个基类的定义,但基类只是一个接口(interface)。以下是完整的错误c:\users\numerical25\desktop\introtodirectx\godfiles\gxrendermanager\gxrendermanager\gxrendermanager\gxdx.h(2):errorC2504:'GXRenderer':baseclassundefined下面是显示标题如何相互链接的代码GXRenderManager.h#ifndefGXRM#defineGXRM#in

c++ - 有没有办法忽略未使用的 undefined reference ?

假设我有两个源文件—UndefErr.cpp:#includevoidUndefFunc();voidFunc2(){UndefFunc();}voidFunc1(){printf("Hi\n");}还有main.cpp:voidFunc1();intmain(){Func1();return0;}正如您在UndefErr.cpp中看到的那样,Func2()将触发错误,因为它使用未定义的UndefFunc().然而main函数并不关心Func2()!根据arelevantquestion我可以将一个选项--unresolved-symbols=ignore-in-object-file