这是代码,非常基本的Cpp

#include <iostream>
using namespace std;

int main(){
    cout << "C++ is FUN!\n";
    return 0;
}


找不到的符号是试图使用名称空间的“ std”和“ cout”。
完整的错误消息是。

make: *** [FirstProject] Error 1    FirstProject            C/C++ Problem
Symbol 'cout' could not be resolved FirstProgram.cpp    /FirstProject   line 5  Semantic Error
Symbol 'std' could not be resolved  FirstProgram.cpp    /FirstProject   line 2  Semantic Error
symbol(s) not found for architecture x86_64 FirstProject            C/C++ Problem


编辑:
这是整个链接器行:

make all
Building target: FirstProject
Invoking: Cross G++ Linker
g++  -o "FirstProject"  ./FirstProgram.o
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [FirstProject] Error 1


有谁知道可能是什么问题?

最佳答案

您没有使用C ++编译器进行编译。

如果使用的是GNU工具链,则使用g++而不是gcc

关于c++ - C++无法在我的Mac上运行,找不到针对架构x86_64的符号,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24912717/

10-09 13:35