刚刚发布了一个简单的 c 代码并收到此错误消息。谁能解释一下问题出在哪里?
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mac@MACs-MacBook-Pro-2 C % cd "/Users/mac/C/" && g++ tes.c++ -o tes && "/Users/mac/C/"tes
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
答案 0 :(得分:2)
你必须用gcc而不是g++编译,g++是编译.cpp或.cc文件
gcc tes.c++ -o tes