簡體   English   中英

g++ 編譯錯誤(體系結構 x86_64 的未定義符號)

[英]g++ compile error (Undefined symbols for architecture x86_64)

當我用 g++-4.9 編譯代碼時

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

當我用 clang++ 編譯時,沒有任何錯誤和警告。 如何通過 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

BaseServer::~BaseServer()inline 沒有inline一切正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM