2015-11-04 62 views
-1

當我用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

回答

0

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

相關問題