boost



  • Hallo unter Ubuntu ist ja Boost 1.37 noch Standard, hat sich bis 1.39 etwas so stark geändert dass es sich lohnen würde boost von hand zu installieren?



  • und noch was ich habe dieses beispiel für threads gefunden

    #include <boost/thread.hpp> 
    #include <iostream> 
    
    void wait(int seconds) 
    { 
      boost::this_thread::sleep(boost::posix_time::seconds(seconds)); 
    } 
    
    void thread() 
    { 
      try 
      { 
        for (int i = 0; i < 5; ++i) 
        { 
          wait(1); 
          std::cout << i << std::endl; 
        } 
      } 
      catch (boost::thread_interrupted&) 
      { 
      } 
    } 
    
    int main() 
    { 
      boost::thread t(thread); 
      wait(3); 
      t.interrupt(); 
      t.join(); 
    }
    

    dieses kompiliert aber nicht bei mir , woran liegt das? an der version ? oder ist da ein fehler drin?



  • Aha. Und wir sollen jetzt raten was du für Fehler beim compilieren bekommst. Klar.



  • entschuldige ^^

    ||=== Boost1, Debug ===|
    obj/Debug/main.o||In function main':| /home/kleopatra/Dokumente/Programmieren/C++/Boost1/main.cpp|28|undefined reference toboost::thread::interrupt()'|
    /home/kleopatra/Dokumente/Programmieren/C++/Boost1/main.cpp|29|undefined reference to boost::thread::join()'| /home/kleopatra/Dokumente/Programmieren/C++/Boost1/main.cpp|29|undefined reference toboost::thread::~thread()'|
    /home/kleopatra/Dokumente/Programmieren/C++/Boost1/main.cpp|29|undefined reference to boost::thread::~thread()'| obj/Debug/main.o||In functionmutex':|
    /usr/include/boost/thread/pthread/mutex.hpp|40|undefined reference to boost::thread\_resource\_error::thread\_resource\_error()'| /usr/include/boost/thread/pthread/mutex.hpp|40|undefined reference toboost::thread_resource_error::~thread_resource_error()'|
    /usr/include/boost/thread/pthread/mutex.hpp|40|undefined reference to typeinfo for boost::thread\_resource\_error'| obj/Debug/main.o||In function~thread_data':|
    /usr/include/boost/thread/detail/thread.hpp|40|undefined reference to boost::detail::thread\_data\_base::~thread\_data\_base()'| /usr/include/boost/thread/detail/thread.hpp|40|undefined reference toboost::detail::thread_data_base::~thread_data_base()'|
    obj/Debug/main.o||In function condition_variable':| /usr/include/boost/thread/pthread/condition\_variable\_fwd.hpp|33|undefined reference toboost::thread_resource_error::thread_resource_error()'|
    /usr/include/boost/thread/pthread/condition_variable_fwd.hpp|33|undefined reference to boost::thread\_resource\_error::~thread\_resource\_error()'| /usr/include/boost/thread/pthread/condition\_variable\_fwd.hpp|33|undefined reference totypeinfo for boost::thread_resource_error'|
    obj/Debug/main.o||In function thread\_data\_base':| /usr/include/boost/thread/pthread/thread\_data.hpp|54|undefined reference tovtable for boost::detail::thread_data_base'|
    obj/Debug/main.o||In function thread<void (*)()>':| /usr/include/boost/thread/detail/thread.hpp|188|undefined reference toboost::thread::start_thread()'|
    obj/Debug/main.o||In function void boost::this\_thread::sleep<boost::posix\_time::seconds>(boost::posix_time::seconds const&)':| /usr/include/boost/thread/pthread/thread\_data.hpp|111|undefined reference toboost::this_thread::sleep(boost::posix_time::ptime const&)'|
    ]+0x10)||undefined reference to `typeinfo for boost::detail::thread_data_base'|
    ||=== Build finished: 16 errors, 0 warnings ===|



  • Ich seh da keine Compilerfehler, nur Linkerfehler.
    Du musst die Thread-Lib auch mitlinken.



  • sry.. kann mir einer sagen wo ich unter ubuntu die anzugebenden dateien finden kann?



  • reicht es evt wenn ich in code::blocks

    folgendes hinzufüge:

    /usr/local/lib



  • ich habe da echt ein problem:

    ich habe gerade

    ../../../../../../usr/lib/libboost_date_time-mt.a

    und alles was ich da gefunden habe in die linker options meines projekts rein und bekomme jetzt :

    ||=== Boost1, Debug ===|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PySequence\_GetSlice'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyExc_ValueError'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyString\_Size'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyBool_Type'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyObject\_GetAttr'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyDict_GetItemString'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyNumber\_And'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyExc_IndexError'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyUnicodeUCS4\_FromEncodedObject'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference to_PyEval_SliceIndex'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyTuple\_Type'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyNumber_InPlaceSubtract'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyList\_Type'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyObject_GetAttrString'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyFile\_FromString'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyModule_Type'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyMem\_Free'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyType_IsSubtype'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyStaticMethod\_Type'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyErr_WarnEx'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyTuple\_New'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyObject_SetAttr'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyObject\_IsInstance'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyErr_NoMemory'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to \_Py_NoneStruct'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyExc_AttributeError'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyNumber\_Add'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyList_Append'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyType\_Type'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyExc_ReferenceError'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyString\_Type'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyStaticMethod_New'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyNumber\_InPlaceMultiply'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyInt_Type'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyTuple\_Size'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyErr_SetObject'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to \_PyObject_New'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyDict_Keys'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyType\_GenericAlloc'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyErr_Format'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyObject\_CallFunction'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyList_Reverse'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyString\_FromString'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPySequence_DelSlice'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyCFunction\_Type'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyExc_OverflowError'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyMem\_Malloc'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyErr_ExceptionMatches'|
    ../../../../../../usr/lib/libboost_python-mt.so||undefined reference to PyComplex\_ImagAsDouble'| ../../../../../../usr/lib/libboost\_python-mt.so||undefined reference toPyCFunction_NewEx'|
    ||More errors follow but not being shown.|
    ||Edit the max errors limit in compiler options...|
    ||=== Build finished: 50 errors, 0 warnings ===|

    was muss ich denn genau angeben?



  • wie wärs, wenn du nur die Datei, die für das threading gebraucht wird linkst? Ich glaube nicht, dass du python brauchst.



  • "boost_thread-mt"


Anmelden zum Antworten