2012-09-18 3 views
1

this 튜토리얼 파일을 boost :: filesystem에서 컴파일하려고합니다.부스트 파일 시스템 튜토리얼 파일 컴파일에 문제가 발생했습니다.

Undefined symbols for architecture x86_64: 
    "boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::codecvt<wchar_t, char, __mbstate_t> const&)", referenced from: 
     boost::filesystem::path::path<boost::filesystem::directory_entry>(boost::filesystem::directory_entry const&, boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<boost::filesystem::directory_entry>::type>, void>::type*) in tut3-FljaLL.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

내가 산 사자에 포함 된 그 소리를 사용하고, 부스트는 brew install --with-mpi --use-clang 함께 설치됩니다 : 나는군요, 그러나

clang++ -std=c++11 -stdlib=libc++ tut3.cpp -L/usr/local/lib -lboost_filesystem-mt -lboost_system-mt 

을 :

나는이 명령을 사용하고 있습니다. mpich2도 --use-clang과 함께 설치됩니다.

용장 링커 출력 : 솔직히 문제가, 어떤 아이디어가 무엇인지 확실하지 않다

Apple clang version 4.0 (tags/Apple/clang-421.0.57) (based on LLVM 3.1svn) 
Target: x86_64-apple-darwin12.1.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 tut3.cpp -pic-level 1 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 133.3 -v -resource-dir /usr/bin/../lib/clang/4.0 -fmodule-cache-path /var/folders/nb/qkspw0z92f506gbjq9gb505r0000gn/T/clang-module-cache -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/spott/Documents/Code/ebss/bin -ferror-limit 19 -fmessage-length 272 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/nb/qkspw0z92f506gbjq9gb505r0000gn/T/tut3-9Q4qRh.o -x c++ tut3.cpp 
clang -cc1 version 4.0 based upon LLVM 3.1svn default target x86_64-apple-darwin12.1.0 
ignoring nonexistent directory "/usr/include/c++/v1" 
#include "..." search starts here: 
#include <...> search starts here: 
/usr/bin/../lib/c++/v1 
/usr/local/include 
/usr/bin/../lib/clang/4.0/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 a.out -L/usr/local/lib/ /var/folders/nb/qkspw0z92f506gbjq9gb505r0000gn/T/tut3-9Q4qRh.o -lboost_filesystem-mt -lboost_system-mt -lc++ -lSystem /usr/bin/../lib/clang/4.0/lib/darwin/libclang_rt.osx.a 
Undefined symbols for architecture x86_64: 
    "boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::codecvt<wchar_t, char, __mbstate_t> const&)", referenced from: 
    boost::filesystem::path::path<boost::filesystem::directory_entry>(boost::filesystem::directory_entry const&, boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<boost::filesystem::directory_entry>::type>, void>::type*) in tut3-9Q4qRh.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

?

+0

링크하려는 라이브러리가 실제로/usr/local/lib에 있는지 확인 했습니까? –

+0

또한 자세한 링커 출력을 게시하면 도움이 될 수 있습니다. –

+0

집에 도착하면 자세한 링크 출력을 게시 하겠지만 라이브러리가 해당 위치에 있는지 확실히 말할 수 있습니다. –

답변

2

MacOS에서 파일 시스템을 사용할 때와 같은 문제가 발생했습니다. "- 표준 = C++ 11 -stdlib = libc의 ++"

/B2 --build-DIR = ../boost_libs 도구 세트 = 그 소리의 CXXFLAGS =

은 다음과 같은 옵션 향상을 컴파일하지 않고 통과 할 수 없습니다 linkflags = "- stdlib = libC++"stage --with-filesystem

이 게시물은 유용했습니다 : here.

+0

컴파일 플래그를 활성화하려면 homebrew의 'brew'명령에 전달할 플래그를 알고 있습니까? 아니면 수동으로 boost.rb를 편집해야합니까? – Sc0ttyD

관련 문제