[Dev-Cpp] Boost-Threads: Verstehe die Installationsschritte nicht!



  • Hallo,

    Ich habe vor ein Programm zu schreiben was im Hintergrund eine Piepton-Folge piept! 😉
    Das Problem:
    Es gibt so viele Bibliotheken
    Am einfachsten erschien mir Boost
    Also dachte ich: Super, also los! 💡

    Headerfiles kopiert
    Beispiel(siehe unten) versucht zu kompilieren-Fehlanzeige
    Libs gesucht-nicht gefunden
    Versucht das Manual zu verstehen-keine Chance
    c-plusplus durchsucht-keine Beiträge gefunden

    Hilfe! 😞

    ⚠ WinXP, Dev-Cpp mit mingw(32)-compiler ⚠

    Das Beispiel:

    // Copyright (C) 2001-2003
    // William E. Kempf
    //
    // Permission to use, copy, modify, distribute and sell this software
    // and its documentation for any purpose is hereby granted without fee,
    // provided that the above copyright notice appear in all copies and
    // that both that copyright notice and this permission notice appear
    // in supporting documentation.  William E. Kempf makes no representations
    // about the suitability of this software for any purpose.
    // It is provided "as is" without express or implied warranty.
    
    #include <boost/thread/thread.hpp>
    #include <boost/thread/xtime.hpp>
    #include <iostream>
    
    struct thread_alarm
    {
        thread_alarm(int secs) : m_secs(secs) { }
        void operator()()
        {
            boost::xtime xt;
            boost::xtime_get(&xt, boost::TIME_UTC);
            xt.sec += m_secs;
    
            boost::thread::sleep(xt);
    
            std::cout << "alarm sounded..." << std::endl;
        }
    
        int m_secs;
    };
    
    int main(int argc, char* argv[])
    {
        int secs = 5;
        std::cout << "setting alarm for 5 seconds..." << std::endl;
        thread_alarm alarm(secs);
        boost::thread thrd(alarm);
        thrd.join();
    }
    


  • Das Beispiel gibt diese Fehlermeldung beim Linken. Ich denke, dass ich bei der Installation irgendwas falsch gemacht habe, da ich alle Dateien im lib-dir zum Test mitgelinkt habe. 🙄 Ich habe gelesen, das die libs "gebaut" werden müssen. Wie geht das? Ich habe das hier gemacht:

    • boost_1_32_0.zip heruntergeladen...
    • boost-jam3.1.10-1-ntx86.zip heruntergeladen...
    • Das ganze entpackt...
    • Die bjam.exe in den Boost-Ordner aus 1 kopiert...
    • bjam "-sTOOLS=mingw" install...
    • gewartet...
    • Nichts mehr, da ich die Dateien nicht gefunden habe und auch nicht weiß was jetzt... 😞
    thread.o(.text+0x1ce):thread.cpp: undefined reference to `_imp___ZN5boost6threadC1ERKNS_9function0IvSaINS_13function_baseEEEE'
    thread.o(.text+0x235):thread.cpp: undefined reference to `_imp___ZN5boost6thread4joinEv'
    thread.o(.text+0x26b):thread.cpp: undefined reference to `_imp___ZN5boost6threadD1Ev'
    thread.o(.text+0x2a0):thread.cpp: undefined reference to `_imp___ZN5boost6threadD1Ev'
    
    thread.o(.text$_ZN12thread_alarmclEv[thread_alarm::operator()()]+0x15):thread.cpp: 
    undefined reference to `_imp___ZN5boost9xtime_getEPNS_5xtimeEi'
    thread.o(.text$_ZN12thread_alarmclEv[thread_alarm::operator()()]+0x36):thread.cpp: 
    undefined reference to `_imp___ZN5boost6thread5sleepERKNS_5xtimeE'
    collect2: ld returned 1 exit status
    

    ➡ Dacht das könnt wichtig sein... Ist es aber wahrscheinlich nicht! Kann mir vielleicht jemand die libs geben?



  • zieh dir erst mal das neuste boost....
    dann einfach wie in getting_started.html steh kompilieren..
    ein bisschen nenglisch wirst du ja noch könne sosnt kannst dus eh vergseeesn mit dem progen

    mfg Shade37337



  • Hallo,

    erst mal danke! Ich habe Boost wohl fehlerhaft heruntergeladen...
    Ich habs gerade nochmal probiert, es geht! Jetzt habe ich C:\Boost! 😃


Anmelden zum Antworten