克++编译错误(架构x86_64的未定义码元)

问题描述:

当我用g ++编译代码 - 4.9克++编译错误(架构x86_64的未定义码元)

g++ main.cpp base_server.cpp base_server.hpp threaded_server.cpp threaded_server.hpp 

我发现了错误:

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 

当我通过铛编译++没有任何错误和警告。如何通过g ++编译它?

base_server.hpp:https://gist.github.com/yutkin/ccecf7d6132ab63db3bd

base_server.cpp:https://gist.github.com/yutkin/833bf593cf1775b3cb21

threaded_server.hpp:https://gist.github.com/yutkin/61ef0a91f1e1c811334b

threaded_server.cpp:https://gist.github.com/yutkin/62821e6791565a54edac

OS X 10.11.1

+1

可能与您的问题没有关系,但是您不能直接编译头文件。从参数中删除'* .hpp'到'g ++' – bolov

BaseServer::~BaseServer()inline。没有inline全部正常工作。