没有找到体系结构x86_64错误的Ld:符号
ld: symbol(s) not found for architecture x86_64 error
我正在尝试遵循http://gnuu.org/2009/09/18/writing-your-own-toy-compiler教程。我得到以下错误:
我错过了什么?
Invoking: GCC C++ Compiler
g++ -std=c++0x -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -I/usr/local/opt/llvm/include -O0 -g3 -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -fPIC -MMD -MP -MF"src/main.d" -MT"src/main.o" -o "src/main.o" "../src/main.cpp"
In file included from ../src/main.cpp:2:
../src/node.h:17:61: warning: control reaches end of non-void function [-Wreturn-type]
virtual llvm::Value* codeGen(CodeGenContext& context) { }
^
../src/node.h:63:19: warning: field 'rhs' will be initialized after field 'op' [-Wreorder]
lhs(lhs), rhs(rhs), op(op) { }
^
2 warnings generated.
Undefined symbols for architecture x86_64:
"yyparse()", referenced from:
_main in main-974049.o
"_programBlock", referenced from:
_main in main-974049.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [src/main.o] Error 1
你错过了一些东西。
-
你忽略了编译器的第一个警告消息是告诉你代码中有一个明显的错误。
-
你的编译器的第二个警告消息告诉你代码中另一个可能的错误。
-
最后,你错过了
-c
选项到g++
,导致编译器试图链接一个不完整的程序,而不是生成一个对象模块。
相关文章:
- 试图在崇高中奔跑. 错误 已发生: 收集2.exe: 错误: ld 返回 1 退出状态
- collect2:错误:ld 返回 1 个退出状态未定义的引用
- C++ collect2:错误:ld 返回 1 退出状态
- 找不到 -llibmysqld Collect2.exe:错误:ld 返回 1 退出状态
- 每次我要使用外部资源时,我都会得到:collect2。exe:错误 ld 返回 1 退出状态
- 当出现错误ld return 1退出状态时,如何编译程序
- Cmake无法在qt-creater/collect2上编译简单的测试程序:错误:ld
- c++ (C::B) 错误:ld 返回 1 个退出状态
- 使用类[错误] LD返回1退出状态
- C++编译错误:ld:找不到体系结构x86_64 clang 的符号:错误:链接器命令失败,退出代码为 1(使用 -v
- 错误:LD返回1个退出状态-CodeBlocks
- mingw32/bin/ld.exe:找不到 -lfl collect2.exe:错误:ld 返回 1 个退出状态
- 当我使用该功能时,"错误 ld 返回 1 个退出状态"boost::log::add_file_log()"
- Apple Mach-O Linker (ld) 错误.ld: -r 和 -dead-strip 不能一起使用
- collect2:错误:ld 在制作带有代码块的 .so 文件(64 位版本)时返回 1 个退出状态
- 生成文件gtkmm;collect2.exe:错误:ld返回1退出状态
- Collect2:错误:LD在C 中返回1个退出状态
- 无法导出mexfunction:符号未定义的collect.exe2.exe:错误:ld返回1退出状态
- 链接错误:收集 2:错误:ld 返回 1 个退出状态
- 在 OS X 上编译lsd_slam会引发链接错误 ld:找不到 -lGL 的库