2010-11-23 11 views
2

Also, ich versuche, boost.process-Bibliothek zu verwenden. Ich heruntergeladene Paket aus this location schließt aus boost Unterverzeichnis kopiert in /usr/include/Boost, einen einfachen Code geschrieben:Boost Linking Fehler

namespace bp = ::boost::process; 
    std::string execApp = "make"; 
    std::vector<std::string> args; 
    args.push_back("-C ../build"); 

    bp::context ctx; 
    ctx.stdout_behavior = bp::silence_stream(); 

    bp::child buildProcess = bp::launch(execApp, args, ctx); 

Es kompiliert aber nicht an Linker:

CMakeFiles/DebugConsole.dir/Debug/DebugConsole.cpp.o: In function `__static_initialization_and_destruction_0': 
/usr/include/boost/system/error_code.hpp:208: undefined reference to `boost::system::get_system_category()' 
/usr/include/boost/system/error_code.hpp:209: undefined reference to `boost::system::get_generic_category()' 
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::get_generic_category()' 
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::get_generic_category()' 
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::get_system_category()' 
CMakeFiles/DebugConsole.dir/Debug/DebugConsole.cpp.o: In function `boost::process::detail::file_handle::posix_remap(int)': 
/usr/include/boost/process/detail/file_handle.hpp:264: undefined reference to `boost::system::get_system_category()' 
/usr/include/boost/process/detail/file_handle.hpp:269: undefined reference to `boost::system::get_system_category()' 
CMakeFiles/DebugConsole.dir/Debug/DebugConsole.cpp.o: In function `boost::process::detail::file_handle::posix_dup(int, int)': 
/usr/include/boost/process/detail/file_handle.hpp:295: undefined reference to `boost::system::get_system_category()' 
CMakeFiles/DebugConsole.dir/Debug/DebugConsole.cpp.o: In function `pipe': 
/usr/include/boost/process/detail/pipe.hpp:86: undefined reference to `boost::system::get_system_category()' 
CMakeFiles/DebugConsole.dir/Debug/DebugConsole.cpp.o:/usr/include/boost/process/detail/posix_ops.hpp:202: more undefined references to `boost::system::get_system_category()' follow 
collect2: ld returned 1 exit status 

Ich habe verknüpft solche Bibliotheken: filesystem system date_time

+0

posten Sie Ihre Verbindungslinie –

Antwort

4

Sie könnten die letzte Antwort here.

sehen wollen

Ich hatte ein sehr ähnliches Problem und fand diesen Beitrag während der Suche. I geschafft, das Problem nach viel mehr Suche zu lösen, so poste ich es hier für andere Menschen.

hatte ich auf diese Weise auf die richtige Bibliothek zu verknüpfen: g ++ boost_example.cpp -o run -lboost_filesystem-mt http://linux.overshoot.tv/ticket/127

Das eigentliche Problem ist, dass die Boost-Dokumentation fehlt und sagt nicht die Bibliothek Link zu. Siehe: http://linux.overshoot.tv/ticket/129

Wie auch immer, boost/file_system verwenden, Link zu: -lboost_filesystem-mt.

Siehe auch: http://ubuntuforums.org/showthread.php?t=244593