Boost logo

Boost Users :

Subject: [Boost-users] [Boost::Thread] Unable to declare boost::thread in a dll problem
From: kmdarkmaster (kmdarkmaster_at_[hidden])
Date: 2011-06-09 10:48:04


Please help me I have a weird problem while testing Boost::Thread. I can
create threads and do stuffs without problem when compiled as an exe, but
unable to declare even a single thread when compiled as a dll. (I'm using MS
Visual Studio 2010 pro).

In fact, when I create a win32 console application and use this code, it
compiles perfectly :


#include "stdafx.h"
#include <boost\thread.hpp>

int _tmain(int argc, _TCHAR* argv[])
        boost::thread myThread;
        return 0;


Now I create a DLL application, create a cpp, and write the same simple code

#include "stdafx.h"
#include <boost\thread.hpp>

void testDLL_Thread(){
        boost::thread myThread;

My DLL has the same boost configuration as the console app, and it doesn't
even export anything.
Now during compilation, i get those Linker error :


LNK1169: un ou plusieurs symboles définis à différentes reprises ont été
LNK2005: "public: __thiscall boost::thread::~thread(void)"
(??1thread_at_boost@@QAE_at_XZ) déjà défini(e) dans
LNK2005: "public: __thiscall boost::thread::thread(void)"
(??0thread_at_boost@@QAE_at_XZ) déjà défini(e) dans


Sorry for the French stuffs but you guys know those errors for sure
I know that many people have already created threads in DLL, so please help
me understand why it didn't work in this simple case.

Thank you very much,


View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at