|
Boost Users : |
Subject: [Boost-users] Linking Error on WaitForSingleObject
From: Anish Chandak (achandak_at_[hidden])
Date: 2011-01-12 03:26:31
Hello All,
I have a very unusual linking issue. It might be trivial but I could
not find any reference after searching on the mailing list and other
forums. I wrote a very simple example code (attached at the end of
message) for using boost lock and mutex. The same piece of code
compiles fine without linking error in one Visual Studio Project and
gives the following linking error in another Visual Studio Project. I
have made sure that the VS settings for each project match exactly.
ERROR: error LNK2019: unresolved external symbol
__imp__WaitForSingleObject__USE_VCR_MODE_at_8 referenced in function
"public: void __thiscall boost::detail::basic_timed_mutex::lock(void)"
(?lock_at_basic_timed_mutex_at_detail@boost@@QAEXXZ)
I am using Visual Studio 2010 and boost 1_45_0. The code is linking to
libboost_thread-vc100-mt-s-1_45.lib in both the projects. Any
suggestions on what could be the possible cause of this or how to fix
this will be highly appreciated.
Thanks,
Anish
boost::mutex active_source_mutex;
class TESTCLASS {
public:
void LOOP(int count) {
int tcount = 0;
for(int j=0; j<count; j++) {
for(int k=0; k<10000000; k++) {
tcount++;
}
printf("%d %d\n",j,tcount);
}
}
void THREAD_CALLBACK() {
boost::mutex::scoped_lock slock(active_source_mutex);
LOOP(10);
}
};
int main() {
TESTCLASS jk;
boost::thread thread_1 = boost::thread(&TESTCLASS::THREAD_CALLBACK, &jk);
boost::thread thread_2 = boost::thread(&TESTCLASS::THREAD_CALLBACK, &jk);
thread_1.join();
thread_2.join();
return 0;
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net