使用 LLVM 时出现链接器错误
Linker errors when using LLVM
我正在尝试使用 LLVM 来构建编译器后端,但我陷入了链接器错误。目前我尝试做的只是包含LLVMContext.h(我正在做IBM教程(,但这给了我以下链接器错误:
$ g++ -o compiler *.o -L/home/jakob/llvm2/lib/*.a -lantlr4-runtime
BayesBaseListener.o:(.data.rel+0x0): undefined reference to `llvm::DisableABIBreakingChecks'
collect2: error: ld returned 1 exit status
Makefile:2: recipe for target 'compiler' failed
make: *** [compiler] Error 1
知道如何正确配置 LLVM 以免发生这种情况吗?
选项-L
是添加链接器用于搜索库的路径。选项-l
(小写 L(是告诉链接器链接到特定库。
但是,对于您的情况,如果要与特定位置的所有静态库链接,只需将库文件列为输入文件:
g++ -o compiler *.o /home/jakob/llvm2/lib/*.a -lantlr4-runtime
请注意,我不使用-L
选项。
相关文章:
- 静态数据成员的问题-修复链接错误会导致编译器错误
- Visual Studio mkl_link_tool.exe链接错误
- C++ 实现模板单例类时出现链接错误
- 使用类模板的方法链接错误
- MySQL C++连接器链接错误
- VS 2015 链接错误 无法构建依赖于 libcurl 的项目
- 运行 C++ 单元测试时LNK2005链接错误
- 对 CMake 中'cudaRegisterLinkedBinary'链接错误的未定义引用?
- 链接错误,包括我创建的相同头文件 - C++
- 在Embarcadero C++ Builder中生成的DLL未解决的外部链接错误
- 使用标头保护的多个定义链接错误
- 链接错误:未定义对 stdscr 和 wgetch 的引用
- 使用 Vivek 的 Vcam / 捕获源过滤器构建/链接错误
- 升压program_options中的链接错误
- 使用 g++ 预处理器进行替换会导致链接错误
- 在调试配置中编译工作正常,但发布会给出链接错误
- 相邻矩阵设置链接错误
- 包含常量变量并包含在多个文件中的标头的链接错误
- C++链接错误,我理解但无法解决
- 是什么导致macOS Mojave上的GoogleTest链接错误