我正在尝试在我的 Mac 上编译一些 C++ 代码。我可以使用 Xcode 运行它,但是当我尝试使用 gcc 从终端编译时,出现以下错误:
Undefined symbols for architecture x86_64:
"std::cout", referenced from:
_main in ccOJDOlb.o
"std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
_main in ccOJDOlb.o
"std::ios_base::Init::Init()", referenced from:
__static_initialization_and_destruction_0(int, int)in ccOJDOlb.o
"std::ios_base::Init::~Init()", referenced from:
___tcf_0 in ccOJDOlb.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
有谁知道可能会发生什么?