[英]g++ compile error (Undefined symbols for architecture x86_64)
When I compile code by g++-4.9当我用 g++-4.9 编译代码时
g++ main.cpp base_server.cpp base_server.hpp threaded_server.cpp threaded_server.hpp
I'm getting error:我收到错误:
Undefined symbols for architecture x86_64:
"BaseServer::~BaseServer()", referenced from:
ThreadedServer::~ThreadedServer() in ccQVIp8S.o
ThreadedServer::~ThreadedServer() in ccQVIp8S.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [all] Error 1
When I compile by clang++ there are no any errors and warning.当我用 clang++ 编译时,没有任何错误和警告。 How to compile it by g++ ?
如何通过 g++ 编译它?
base_server.hpp: https://gist.github.com/yutkin/ccecf7d6132ab63db3bd base_server.hpp: https ://gist.github.com/yutkin/ccecf7d6132ab63db3bd
base_server.cpp: https://gist.github.com/yutkin/833bf593cf1775b3cb21 base_server.cpp: https ://gist.github.com/yutkin/833bf593cf1775b3cb21
threaded_server.hpp: https://gist.github.com/yutkin/61ef0a91f1e1c811334b threaded_server.hpp: https : //gist.github.com/yutkin/61ef0a91f1e1c811334b
threaded_server.cpp: https://gist.github.com/yutkin/62821e6791565a54edac threaded_server.cpp: https : //gist.github.com/yutkin/62821e6791565a54edac
OS X 10.11.1 OS X 10.11.1
BaseServer::~BaseServer()
was inline
. BaseServer::~BaseServer()
是inline
。 Without inline
all works properly.没有
inline
一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.