2014-09-21 72 views
-1

我似乎無法獲得代碼塊13.12在clang ++和g ++中正確編譯C++ 11。使用clang ++進行編譯時,我附加了-std = C++ 11和-stdlib = libC++。這導致鏈接錯誤。對於g ++,當您添加-std = C++ 11或-std = C++ 0x時,編譯器無法找到隨機標題。當我使用clang ++和g ++在終端中手動編譯代碼時,沒有發生這些錯誤。C++代碼塊中的11個編譯問題

完整的鏈接錯誤太長,所以我只會發布從-v調用給出的信息。 在使用鐺++與-std = C++ 11和-stdlib = libc的++碼塊:

Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) 
Target: x86_64-apple-darwin12.5.0 
Thread model: posix 
"/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0 -o bin/Release/p_class_test obj/Release/Thread_Pool/thread_helper.o obj/Release/Thread_Pool/thread_pool.o obj/Release/Desktop/kmap_testing/hash_methods.o obj/Release/Desktop/p_class_test/p_classtest.o obj/Release/Desktop/p_class_test/refmanager.o -lstdc++ -lSystem /usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a 

使用鐺++與-std = C++ 11和-stdlib = ++的libc編譯在終端:

Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) 
Target: x86_64-apple-darwin12.5.0 
Thread model: posix 
"/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name thread_helper.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -resource-dir /usr/bin/../lib/clang/5.1 -I /Users/zacharykraus/Desktop/p_class_test/ -I /Users/zacharykraus/Thread_Pool/ -I /Users/zacharykraus/Desktop/kmap_testing/ -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/zacharykraus -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.8.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T/thread_helper-57c077.o -x c++ /Users/zacharykraus/Thread_Pool/thread_helper.cpp 
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin12.5.0 
ignoring nonexistent directory "/usr/include/c++/v1" 
#include "..." search starts here: 
#include <...> search starts here: 
/Users/zacharykraus/Desktop/p_class_test 
/Users/zacharykraus/Thread_Pool 
/Users/zacharykraus/Desktop/kmap_testing 
/usr/bin/../lib/c++/v1 
/usr/local/include 
/usr/bin/../lib/clang/5.1/include 
/usr/include 
/System/Library/Frameworks (framework directory) 
/Library/Frameworks (framework directory) 
End of search list. 
"/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name thread_pool.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -resource-dir /usr/bin/../lib/clang/5.1 -I /Users/zacharykraus/Desktop/p_class_test/ -I /Users/zacharykraus/Thread_Pool/ -I /Users/zacharykraus/Desktop/kmap_testing/ -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/zacharykraus -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.8.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T/thread_pool-321d19.o -x c++ /Users/zacharykraus/Thread_Pool/thread_pool.cpp 
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin12.5.0 
ignoring nonexistent directory "/usr/include/c++/v1" 
#include "..." search starts here: 
#include <...> search starts here: 
/Users/zacharykraus/Desktop/p_class_test 
/Users/zacharykraus/Thread_Pool 
/Users/zacharykraus/Desktop/kmap_testing 
/usr/bin/../lib/c++/v1 
/usr/local/include 
/usr/bin/../lib/clang/5.1/include 
/usr/include 
/System/Library/Frameworks (framework directory) 
/Library/Frameworks (framework directory) 
End of search list. 
"/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name hash_methods.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -resource-dir /usr/bin/../lib/clang/5.1 -I /Users/zacharykraus/Desktop/p_class_test/ -I /Users/zacharykraus/Thread_Pool/ -I /Users/zacharykraus/Desktop/kmap_testing/ -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/zacharykraus -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.8.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T/hash_methods-b28b1b.o -x c++ /Users/zacharykraus/Desktop/kmap_testing/hash_methods.cpp 
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin12.5.0 
ignoring nonexistent directory "/usr/include/c++/v1" 
#include "..." search starts here: 
#include <...> search starts here: 
/Users/zacharykraus/Desktop/p_class_test 
/Users/zacharykraus/Thread_Pool 
/Users/zacharykraus/Desktop/kmap_testing 
/usr/bin/../lib/c++/v1 
/usr/local/include 
/usr/bin/../lib/clang/5.1/include 
/usr/include 
/System/Library/Frameworks (framework directory) 
/Library/Frameworks (framework directory) 
End of search list. 
"/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name p_classtest.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -resource-dir /usr/bin/../lib/clang/5.1 -I /Users/zacharykraus/Desktop/p_class_test/ -I /Users/zacharykraus/Thread_Pool/ -I /Users/zacharykraus/Desktop/kmap_testing/ -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/zacharykraus -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.8.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T/p_classtest-ad56a5.o -x c++ /Users/zacharykraus/Desktop/p_class_test/p_classtest.cpp 
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin12.5.0 
ignoring nonexistent directory "/usr/include/c++/v1" 
#include "..." search starts here: 
#include <...> search starts here: 
/Users/zacharykraus/Desktop/p_class_test 
/Users/zacharykraus/Thread_Pool 
/Users/zacharykraus/Desktop/kmap_testing 
/usr/bin/../lib/c++/v1 
/usr/local/include 
/usr/bin/../lib/clang/5.1/include 
/usr/include 
/System/Library/Frameworks (framework directory) 
/Library/Frameworks (framework directory) 
End of search list. 
"/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name refmanager.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -resource-dir /usr/bin/../lib/clang/5.1 -I /Users/zacharykraus/Desktop/p_class_test/ -I /Users/zacharykraus/Thread_Pool/ -I /Users/zacharykraus/Desktop/kmap_testing/ -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/zacharykraus -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.8.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T/refmanager-d17474.o -x c++ /Users/zacharykraus/Desktop/p_class_test/refmanager.cpp 
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin12.5.0 
ignoring nonexistent directory "/usr/include/c++/v1" 
#include "..." search starts here: 
#include <...> search starts here: 
/Users/zacharykraus/Desktop/p_class_test 
/Users/zacharykraus/Thread_Pool 
/Users/zacharykraus/Desktop/kmap_testing 
/usr/bin/../lib/c++/v1 
/usr/local/include 
/usr/bin/../lib/clang/5.1/include 
/usr/include 
/System/Library/Frameworks (framework directory) 
/Library/Frameworks (framework directory) 
End of search list. 
"/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0 -o nork /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T/thread_helper-57c077.o /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T/thread_pool-321d19.o /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T/hash_methods-b28b1b.o /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T/p_classtest-ad56a5.o /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T/refmanager-d17474.o -lc++ -lSystem /usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a 

不幸的是,我不能在終端中比較codeblocks g ++和g ++。

但基於clang中兩種不同彙編的輸出。在鏈接步驟中,代碼塊不會使用libC++庫。你如何獲得codeblocks使用正確的庫鏈接鏗鏘++?

我假設基於clang問題代碼塊中的g ++使用較舊的C++ 03庫,即使告訴編譯器切換到C++ 11。但不幸的是,我不知道如何確認這一點。

+1

你應該在你的問題提供了鏈接錯誤(或它們的樣品)。可能相關:[使用代碼塊13.12時缺少一些C++ 11功能](http://stackoverflow.com/questions/21075852/some-c11-features-missing-when-using-code-blocks-13-12- mingw的-4-8-1和 - SFML-2)。 C++ 11也給Eclipse帶來了問題。脆弱的是讓事情正常工作。 – jww 2014-09-21 17:05:58

+0

@jww謝謝我添加了錯誤消息,現在我對問題的性質有了更好的瞭解,但不知道如何解決它。我查看了該帖子,並認爲我們遇到了不同的問題。但我不是100%肯定的。 – 2014-09-21 17:27:49

+0

@jww我最終通過採納你的建議和令人興奮的結果找到了解決方案。 – 2014-09-22 04:23:18

回答

1

我找到了clang ++的答案。

顯然你必須添加-stdlib = libC++作爲編譯器標誌和鏈接標誌。

的聯動輸出變爲

Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) 
Target: x86_64-apple-darwin12.5.0 
Thread model: posix 
"/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0 -o bin/Release/p_class_test obj/Release/Thread_Pool/thread_helper.o obj/Release/Thread_Pool/thread_pool.o obj/Release/Desktop/kmap_testing/hash_methods.o obj/Release/Desktop/p_class_test/p_classtest.o obj/Release/Desktop/p_class_test/refmanager.o -lc++ -lSystem /usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a 

其中清楚地示出使用了正確的庫。

g ++問題的發生是因爲即使代碼塊輸出是用g ++編譯的,實際上它使用clang ++庫作爲編譯和鏈接過程的一部分。儘管如此,如果g ++編譯器及其包含被調用,基於輸出不能100%清除。要解決此問題,您需要爲編譯和鏈接添加-stdlib = libC++標誌。爲證明蘋果上的代碼塊實際上使用了引擎蓋下的clang庫,我在鏈接和編譯以及代碼塊使用的命令期間附加了-v的輸出。

這裏是鏈接的信息:

g++ -o bin/Debug/p_class_test obj/Debug/Thread_Pool/thread_helper.o obj/Debug/Thread_Pool/thread_pool.o obj/Debug/Desktop/kmap_testing/hash_methods.o obj/Debug/Desktop/p_class_test/p_classtest.o obj/Debug/Desktop/p_class_test/refmanager.o -v -stdlib=libc++ 
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) 
Target: x86_64-apple-darwin12.5.0 
Thread model: posix 
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0 -o bin/Debug/p_class_test obj/Debug/Thread_Pool/thread_helper.o obj/Debug/Thread_Pool/thread_pool.o obj/Debug/Desktop/kmap_testing/hash_methods.o obj/Debug/Desktop/p_class_test/p_classtest.o obj/Debug/Desktop/p_class_test/refmanager.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a 

這裏是編譯的信息:

g++ -g -std=c++11 -stdlib=libc++ -v -I/Users/zacharykraus/Desktop/p_class_test/ -I/Users/zacharykraus/Thread_Pool -I/Users/zacharykraus/Desktop/kmap_testing -c /Users/zacharykraus/Desktop/p_class_test/refmanager.cpp -o obj/Debug/Desktop/p_class_test/refmanager.o 
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) 
Target: x86_64-apple-darwin12.5.0 
Thread model: posix 
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name refmanager.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -gdwarf-2 -coverage-file /Users/zacharykraus/Desktop/p_class_test/obj/Debug/Desktop/p_class_test/refmanager.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1 -I /Users/zacharykraus/Desktop/p_class_test/ -I /Users/zacharykraus/Thread_Pool -I /Users/zacharykraus/Desktop/kmap_testing -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/zacharykraus/Desktop/p_class_test -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.8.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-slp -o obj/Debug/Desktop/p_class_test/refmanager.o -x c++ /Users/zacharykraus/Desktop/p_class_test/refmanager.cpp 
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin12.5.0 
ignoring nonexistent directory "/usr/include/c++/v1" 
#include "..." search starts here: 
#include <...> search starts here: 
/Users/zacharykraus/Desktop/p_class_test 
/Users/zacharykraus/Thread_Pool 
/Users/zacharykraus/Desktop/kmap_testing 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1 
/usr/local/include 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/include 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include 
/usr/include 
/System/Library/Frameworks (framework directory) 
/Library/Frameworks (framework directory) 
End of search list. 

了很多煩惱,我終於想通了什麼與G ++的問題是在代碼塊之後。問題是調用g ++時的代碼塊不會使用您的可執行文件路徑。相反,它使用編譯器設置中的工具鏈可執行文件路徑。我的工具鏈可執行文件路徑被設置爲/ usr/bin,其中蘋果版本的g ++所在。這個版本實際上通過一系列複雜的調用來調用clang ++。我所需要解決的問題是將工具鏈可執行文件路徑更改爲我的實際gnu編譯器所在的/ usr/local/bin。在這個改變之後,我能夠擺脫-stdlib = libC++,我的編譯和鏈接讀數如下。

編譯:

g++ -g -std=c++11 -v -I/Users/zacharykraus/Desktop/p_class_test/ -I/Users/zacharykraus/Thread_Pool -I/Users/zacharykraus/Desktop/kmap_testing -c /Users/zacharykraus/Thread_Pool/thread_helper.cpp -o obj/Debug/Thread_Pool/thread_helper.o 
Using built-in specs. 
COLLECT_GCC=g++ 
Target: x86_64-apple-darwin12.5.0 
Configured with: ../gcc-4.8.1/configure --enable-languages=c++,fortran 
Thread model: posix 
gcc version 4.8.1 (GCC) 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-g' '-std=c++11' '-v' '-I' '/Users/zacharykraus/Desktop/p_class_test/' '-I' '/Users/zacharykraus/Thread_Pool' '-I' '/Users/zacharykraus/Desktop/kmap_testing' '-c' '-o' 'obj/Debug/Thread_Pool/thread_helper.o' '-shared-libgcc' '-mtune=core2' 
/usr/local/libexec/gcc/x86_64-apple-darwin12.5.0/4.8.1/cc1plus -quiet -v -I /Users/zacharykraus/Desktop/p_class_test/ -I /Users/zacharykraus/Thread_Pool -I /Users/zacharykraus/Desktop/kmap_testing -D__DYNAMIC__ /Users/zacharykraus/Thread_Pool/thread_helper.cpp -fPIC -feliminate-unused-debug-symbols -quiet -dumpbase thread_helper.cpp -mmacosx-version-min=10.8.5 -mtune=core2 -auxbase-strip obj/Debug/Thread_Pool/thread_helper.o -g -std=c++11 -version -o /var/folders/k5/ywc_m0js3z3byh3yqwbfmfj00000gn/T//ccVidneY.s 
GNU C++ (GCC) version 4.8.1 (x86_64-apple-darwin12.5.0) 
    compiled by GNU C version 4.8.1, GMP version 4.3.1, MPFR version 2.4.1, MPC version 0.8.1 
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 
ignoring nonexistent directory "/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/../../../../x86_64-apple-darwin12.5.0/include" 
#include "..." search starts here: 
#include <...> search starts here: 
/Users/zacharykraus/Desktop/p_class_test/ 
/Users/zacharykraus/Thread_Pool 
/Users/zacharykraus/Desktop/kmap_testing 
/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/../../../../include/c++/4.8.1 
/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/../../../../include/c++/4.8.1/x86_64-apple-darwin12.5.0 
/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/../../../../include/c++/4.8.1/backward 
/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/include 
/usr/local/include 
/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/include-fixed 
/usr/include 
/System/Library/Frameworks 
/Library/Frameworks 
End of search list. 

鏈接:

g++ -o bin/Debug/p_class_test obj/Debug/Thread_Pool/thread_helper.o obj/Debug/Thread_Pool/thread_pool.o obj/Debug/Desktop/kmap_testing/hash_methods.o obj/Debug/Desktop/p_class_test/p_classtest.o obj/Debug/Desktop/p_class_test/refmanager.o -v 
Using built-in specs. 
COLLECT_GCC=g++ 
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin12.5.0/4.8.1/lto-wrapper 
Target: x86_64-apple-darwin12.5.0 
Configured with: ../gcc-4.8.1/configure --enable-languages=c++,fortran 
Thread model: posix 
gcc version 4.8.1 (GCC) 
COMPILER_PATH=/usr/local/libexec/gcc/x86_64-apple-darwin12.5.0/4.8.1/:/usr/local/libexec/gcc/x86_64-apple-darwin12.5.0/4.8.1/:/usr/local/libexec/gcc/x86_64-apple-darwin12.5.0/:/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/:/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/ 
LIBRARY_PATH=/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/:/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/../../../:/usr/lib/ 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-o' 'bin/Debug/p_class_test' '-v' '-shared-libgcc' '-mtune=core2' 
/usr/local/libexec/gcc/x86_64-apple-darwin12.5.0/4.8.1/collect2 -dynamic -arch x86_64 -macosx_version_min 10.8.5 -weak_reference_mismatches non-weak -o bin/Debug/p_class_test -L/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1 -L/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/../../.. obj/Debug/Thread_Pool/thread_helper.o obj/Debug/Thread_Pool/thread_pool.o obj/Debug/Desktop/kmap_testing/hash_methods.o obj/Debug/Desktop/p_class_test/p_classtest.o obj/Debug/Desktop/p_class_test/refmanager.o -lstdc++ -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v 
collect2 version 4.8.1 
/usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.8.5 -weak_reference_mismatches non-weak -o bin/Debug/p_class_test -L/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1 -L/usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1/../../.. obj/Debug/Thread_Pool/thread_helper.o obj/Debug/Thread_Pool/thread_pool.o obj/Debug/Desktop/kmap_testing/hash_methods.o obj/Debug/Desktop/p_class_test/p_classtest.o obj/Debug/Desktop/p_class_test/refmanager.o -lstdc++ -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lSystem -v 
@(#)PROGRAM:ld PROJECT:ld64-236.4 
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 armv6m armv7m armv7em 
Library search paths: 
    /usr/local/lib/gcc/x86_64-apple-darwin12.5.0/4.8.1 
    /usr/local/lib 
    /usr/lib 
    /usr/local/lib 
Framework search paths: 
    /Library/Frameworks/ 
    /System/Library/Frameworks/ 
+0

我終於弄清楚上面的g ++調用正在做什麼。他們使用xcode調用來調用clang ++編譯器。這包括clang的包含和他們的庫。 – 2014-09-23 14:41:34