我想编译一个C++程序,它在Xcode中工作正常,但在终端中给出错误。Mac OS X给出的架构x86_64找不到ld:symbol(s)
的main.cpp
int main(int argc, const char * argv[])
{
Example* example =new Example();
example->show();
}
example.h文件
class Example {
public:
void show();
};
example.cpp
void Example::show() {
std::cout<<"Hello World"<<std::endl;
}
的错误,我得到
"Example::show()", referenced from:
_main in cckpIa3V.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
我使用G ++
g++ -o test main.cpp
“但在终端出现错误”究竟是什么意思?你是否试图在命令行上编译?如果是这样,请显示您的命令行! – trojanfoe 2013-03-05 15:07:34
g ++ -o test main.cpp – Kathick 2013-03-05 15:08:55