Je tente pour la première fois d'utiliser Boost thread, j'essaie donc de compiler un code d'exemple trouvé dans le dossier boost.

helloworld3.cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright (C) 2001-2003
// William E. Kempf
//
//  Distributed under the Boost Software License, Version 1.0. (See accompanying 
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
#include <iostream>
 
void helloworld(const char* who)
{
    std::cout << who << "says, \"Hello World.\"" << std::endl;
}
 
int main()
{
    boost::thread thrd(boost::bind(&helloworld, "Bob"));
    thrd.join();
}
Le premier problème que j'ai rencontré était l'absence des libraries "libboost_thread-vc100-mt-s-1_48.lib" et "libboost_date_time-vc100-s-1_48.lib". Après avoir compiler boost, j'ai récupéré les librairie manquante mais il me reste des erreurs à l'édition de lien que je ne comprend pas.

le commande qui me sert à compiler :
cl /I"C:\boost\boost_1_48_0" /EHsc helloworld3.cpp /link /LIBPATH:"C:\boost\boost_1_48_0\stage\lib"

les erreurs :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
helloworld3.obj : error LNK2019: symbole externe non résolu "public: __cdecl boo
st::thread::~thread(void)" (??1thread@boost@@QEAA@XZ) référencé dans la fonction
 main
helloworld3.obj : error LNK2019: symbole externe non résolu "public: void __cdec
l boost::thread::join(void)" (?join@thread@boost@@QEAAXXZ) référencé dans la fon
ction main
helloworld3.obj : error LNK2019: symbole externe non résolu "private: void __cde
cl boost::thread::start_thread(void)" (?start_thread@thread@boost@@AEAAXXZ) réfé
rencé dans la fonction "public: __cdecl boost::thread::thread<class boost::_bi::
bind_t<void,void (__cdecl*)(char const *),class boost::_bi::list1<class boost::_
bi::value<char const *> > > >(class boost::_bi::bind_t<void,void (__cdecl*)(char
 const *),class boost::_bi::list1<class boost::_bi::value<char const *> > >,stru
ct boost::thread::dummy *)" (??$?0V?$bind_t@XP6AXPEBD@ZV?$list1@V?$value@PEBD@_b
i@boost@@@_bi@boost@@@_bi@boost@@@thread@boost@@QEAA@V?$bind_t@XP6AXPEBD@ZV?$lis
t1@V?$value@PEBD@_bi@boost@@@_bi@boost@@@_bi@1@PEAUdummy@01@@Z)
helloworld3.exe : fatal error LNK1120: 3 externes non résolus
Merci d'avance pour votre aide.