草庐IT

symbolication

全部标签

c++ - constexpr 函数的 undefined symbol

当我尝试编译以下代码时,出现链接器错误:Undefinedsymbolsforarchitecturex86_64:"Foo()",referencedfrom:_maininmain.ousingLLVM4.2。此行为仅在函数标记为constexpr时发生。当函数被标记为const时,程序会正确编译和链接。为什么声明函数constexpr会导致链接器错误?(我意识到以这种方式编写函数并没有带来编译时计算的好处;此时我很好奇为什么函数无法链接。)ma​​in.cpp#include#include"test.hpp"intmain(){intbar=Foo();std::couttes

c++ - undefined symbol 的一般故障排除技术 - gcc

我只是想知道是否有一种有效的技术来解决gcc中undefinedsymbol。有时我的一个项目无法链接,我通常会花很多时间寻找原因。通常它是一个深深隐藏的makefile中的错字,不正确的环境变量或类似的东西。如果您的构建突然因“undefinedsymbol”而死机并且原因不明显,您会使用什么方法? 最佳答案 说这是我的开始配置:/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/crt1.o:Infunction`_start':(.text+0x18):undefinedrefe

c++ - 另一个 "ld: symbol(s) not found for architecture x86_64"问题与 boost,这次是 mgiza

对于提出如此常见的问题,我深表歉意;我找不到任何可行或足够清晰的解决方案让我实现。我只是想安装mgiza.这是安装文件:cmake.makemakeinstallIfyouwanttoinstalltoacustomlocation,addthefollowingflagwhenyouruncmake:-DCMAKE_INSTALL_PREFIX=/path/to/custom/locationNOTE:BoostVersion1.48hasproblemwiththecode,youcanuseeither1.46or1.50+.Unfortunately1.48isshippedw

c++ - ___sincos_stret 链接时 undefined symbol

就像之前提到的here,___sincos_stret在使用Xcode5命令行工具编译使用此符号的项目时找不到。在上面引用的线程中,针对IOS目标发布了解决方案(将-miphoneos-version-min=5.0传递给编译器),是否有桌面解决方案(x64)目标?例如,当我尝试编译polycode时会发生这种情况.编辑2:奇怪的是,在手动编译上一个错误中引用的库后,错误现在恰好位于lto.o,这是一个内部llvmheader本身...undef:___sincos_stretUndefinedsymbolsforarchitecturex86_64:"___sincos_stret"

c++ - "Undefined symbols"简单模板类的链接器错误

已经离开C++几年了,我从以下代码中得到一个链接器错误:基因.h#ifndefGENE_H_INCLUDED#defineGENE_H_INCLUDEDtemplateclassGene{public:TgetValue();voidsetValue(Tvalue);voidsetRange(Tmin,Tmax);private:Tvalue;TminValue;TmaxValue;};#endif//GENE_H_INCLUDED基因.cpp#include"Gene.h"templateTGene::getValue(){returnthis->value;}templatevoi

c++ - 错误 LNK2001 : unresolved external symbol "private: static class

errorLNK2001:unresolvedexternalsymbol"private:staticclassirrklang::ISoundEngine*GameEngine::Sound::_soundDevice"(?_soundDevice@Sound@GameEngine@@0PAVISoundEngine@irrklang@@A)我无法弄清楚为什么我会收到此错误。我相信我正在正确初始化。有人可以帮忙吗?声音.hclassSound{private:staticirrklang::ISoundEngine*_soundDevice;public:Sound();~Soun

c++ - nm 命令中的 "symbol value"是什么意思?

当您列出静态库的符号表时,例如nmmylib.a,每个符号旁边显示的8位十六进制是什么意思?那是代码中每个符号的相对位置吗?另外,多个符号可以具有相同的符号值吗?一堆不同的符号都具有00000000的符号值有什么问题吗? 最佳答案 这是我用C编写的一段代码:#include#includevoidfoo();intmain(intargc,char*argv[]){foo();}voidfoo(){printf("Foobarbaz!");}我在该代码上运行了gcc-cfoo.c。这是nmfoo.o显示的内容:00000000000

c++ - osx 上的编译错误 "Undefined symbols"

我在osx上尝试了一个非常简单的cpp程序,只是为了让自己熟悉osx平台,所以遇到任何错误消息我都很惊讶。代码如下:#includeusingnamespacestd;intmain(){cout我通过运行编译它gcc-Wallhello.cpp-ohello然后我收到“undefinedsymbol”消息:Undefinedsymbols:"std::basic_ostream>&std::operator>(std::basic_ostream>&,charconst*)",referencedfrom:_maininccA9oElQ.o"std::ios_base::Init::

c++ - 错误 : symbol(s) not found for architecture x86_64, collect2:ld 返回 1 个退出状态

我一直在为Qt上的一个问题苦苦挣扎。这是我的代码:hexbutton.h:#ifndefHEXBUTTON_H#defineHEXBUTTON_H#include#include#includeclassHexButton:publicQPushButton{Q_OBJECTpublic:HexButton(QWidget*parent,QIcon&icon,inti,intj);publicslots:voidchangeIcon();};#endif//HEXBUTTON_HHexbutton.cpp:#include"hexbutton.h"HexButton::HexButto

c++ - 共享库或 dylib 中 undefined symbol 的处理方式是什么?

我有一个用于linux的Makefile,我将其移植到Darwin。makefile需要一堆.o文件并将它们链接在一起成为一个.so共享对象。好的,所以我想(我错了吗?)Darwin最好的模拟是dylib。所以我将-shared标志更改为-dynamiclib。现在我链接到dylib的代码依赖于许多外部库。当我尝试构建dylib时,我收到错误消息,提示存在undefinedreference。但是LinuxMakefile没有在创建.so文件的构建步骤中指定任何-lwhatever或-L/path/whatever选项。嗯?这是因为当您创建ELF.so文件时,默认情况下它会保留未解析的