Ich benutze OS X 10.7.3. Ich habe jetzt eine Zeit lang mit den Boost-Header zu spielen und ich wollte jedoch auf mit der Boost.Filesystem lib bewegen hält es diese Nachricht an mich zu werfen:Der Versuch, Boost.Filesystem zu verwenden, scheint jedoch nicht zu verlinken?
Undefined symbols for architecture x86_64:
"boost::system::generic_category()", referenced from:
__static_initialization_and_destruction_0(int, int)in ccOhIhNG.o
boost::filesystem3::detail::create_directories(boost::filesystem3::path const&, boost::system::error_code*)in libboost_filesystem.a(operations.o)
boost::filesystem3::detail::canonical(boost::filesystem3::path const&, boost::filesystem3::path const&, boost::system::error_code*)in libboost_filesystem.a(operations.o)
"boost::system::system_category()", referenced from:
__static_initialization_and_destruction_0(int, int)in ccOhIhNG.o
(anonymous namespace)::error(bool, boost::system::error_code const&, boost::filesystem3::path const&, boost::system::error_code*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libboost_filesystem.a(operations.o)
(anonymous namespace)::error(bool, boost::filesystem3::path const&, boost::system::error_code*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libboost_filesystem.a(operations.o)
(anonymous namespace)::error(bool, boost::filesystem3::path const&, boost::filesystem3::path const&, boost::system::error_code*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libboost_filesystem.a(operations.o)
boost::filesystem3::detail::dir_itr_close(void*&, void*&)in libboost_filesystem.a(operations.o)
boost::filesystem3::detail::directory_iterator_increment(boost::filesystem3::directory_itera tor&, boost::system::error_code*)in libboost_filesystem.a(operations.o)
boost::filesystem3::detail::directory_iterator_construct(boost::filesystem3::directory_itera tor&, boost::filesystem3::path const&, boost::system::error_code*)in libboost_filesystem.a(operations.o)
...
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
ich das, wenn ich versuche, mit zu kompilieren Dies ist:
Also ging ich zurück zu den boost.org Tutorials und probierte das Regex-Beispiel aus. Es funktionierte perfekt dies mit:
g++ -o test main.cpp -I -l/opt/local/include ~/boost/libs/libboost_regex.a
Er kehrte diesen Fehler: 'Nicht definierte Symbole für Architektur x86_64: "boost :: system :: generic_category()", verwiesen von: __static_initialization_and_destruction_0 (int, int) in ccWyCTY8.o „boost :: system :: system_category()“, verwiesen von: __static_initialization_and_destruction_0 (int, int) in ccWyCTY8.o ld: Symbol (e) nicht für die Architektur x86_64 collect2 gefunden: ld zurück Exit-Status 1 ' –
es sieht aus wie Sie libboost_system fehlt sind auch. Füge einfach '-lboost_system' hinzu. – juanchopanza
heiliger Mist, vielen Dank! –