Solved

Visual Studio & Boost C++ build problem

Posted on 2008-10-25
6
2,212 Views
Last Modified: 2013-11-26
Hi Experts!

I am trying to build a C++ project in Visual Studio 2005 that makes use of the Boost C++ threading libraries. However, I am getting a series of LNK2019 errors shown in the code snippet. I asked someone how to get around this problem, and they said:

"Enable the define DBOOST_LIB_DIAGNOSTIC and see if it is properly auto-linking to the correct boost library (libboost_threads in this case). If you are building on win64, you will need to also define DBOOST_BIND_ENABLE_STDCALL."

I am indeed trying to build on win64, but don't understand how to apply said solution. Could I please get some help? Thank you.
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: void __cdecl boost::thread::join(void)" (?join@thread@boost@@QEAAXXZ) referenced in function "public: __cdecl GPUWorker::~GPUWorker(void)" (??1GPUWorker@@QEAA@XZ)

1>.....

1>.....

1>../../bin/win64/Debug/simpleMultiGPU.exe : fatal error LNK1120: 11 unresolved externals

Open in new window

0
Comment
Question by:Vense
  • 3
  • 2
6 Comments
 
LVL 17

Expert Comment

by:CSecurity
Comment Utility
Did you added pragma comment to boost lib files?

#pragma comment(lib, "BOOSTLIBNAMEHERE.LIB")

You need to add it after your #includes
0
 

Author Comment

by:Vense
Comment Utility
Unfortunately that didn't change any of the error messages. I'm not very skilled with the linker, so I just don't understand how to try what is in quoted text.
0
 
LVL 17

Accepted Solution

by:
CSecurity earned 250 total points
Comment Utility
Check boost LIB folder or any location boost have *.lib files, find one that you use, maybe something like boost_thread.lib, then put that in quotes.

0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 17

Expert Comment

by:CSecurity
Comment Utility
Also don't forget Boost LIB and Include folders should be defined in directories of Visual Studio...

That is in Tools -> Options -> Directories (something like that)

You need to add Boost Include folder into Includes of Visual Studio and Boot Lib folder into Lib folders of Visual Studio.
0
 
LVL 1

Assisted Solution

by:sridhard
sridhard earned 250 total points
Comment Utility
Hi,

Confirm your library  and your project(simpleMultiGPU) are compiled with Multi-threaded (/MT ) or Multi-threaded Debug (/MTd) option in "Configuration properties -> C++ -> Code Generation -> Runtime Library"

Also you can confirm whether  you have included the library file under your simpleMultiGPU projects "Configuration properties -> Linker -> Input -> Additional Dependencies"

Regards,
Sri
0
 

Author Comment

by:Vense
Comment Utility
Thanks for the responses guys. However the errors are still occurring. This is the full error output:

1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: void __cdecl boost::thread::join(void)" (?join@thread@boost@@QEAAXXZ) referenced in function "public: __cdecl GPUWorker::~GPUWorker(void)" (??1GPUWorker@@QEAA@XZ)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::thread_resource_error::thread_resource_error(void)" (??0thread_resource_error@boost@@QEAA@XZ) referenced in function "void * __cdecl boost::detail::win32::create_anonymous_event(enum boost::detail::win32::event_type,enum boost::detail::win32::initial_event_state)" (?create_anonymous_event@win32@detail@boost@@YAPEAXW4event_type@123@W4initial_event_state@123@@Z)
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl boost::thread_resource_error::~thread_resource_error(void)" (??1thread_resource_error@boost@@UEAA@XZ)
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual char const * __cdecl boost::thread_resource_error::what(void)const " (?what@thread_resource_error@boost@@UEBAPEBDXZ)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl boost::thread_exception::~thread_exception(void)" (??1thread_exception@boost@@UEAA@XZ) referenced in function "public: virtual void * __cdecl boost::thread_exception::`scalar deleting destructor'(unsigned int)" (??_Gthread_exception@boost@@UEAAPEAXI@Z)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::lock_error::lock_error(void)" (??0lock_error@boost@@QEAA@XZ) referenced in function "public: void __cdecl boost::unique_lock<class boost::mutex>::lock(void)" (?lock@?$unique_lock@Vmutex@boost@@@boost@@QEAAXXZ)
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl boost::lock_error::~lock_error(void)" (??1lock_error@boost@@UEAA@XZ)
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual char const * __cdecl boost::lock_error::what(void)const " (?what@lock_error@boost@@UEBAPEBDXZ)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "private: void __cdecl boost::thread::start_thread(void)" (?start_thread@thread@boost@@AEAAXXZ) referenced in function "public: __cdecl boost::thread::thread<class boost::_bi::bind_t<void,class boost::_mfi::mf0<void,class GPUWorker>,class boost::_bi::list1<class boost::_bi::value<class GPUWorker *> > > >(class boost::_bi::bind_t<void,class boost::_mfi::mf0<void,class GPUWorker>,class boost::_bi::list1<class boost::_bi::value<class GPUWorker *> > >)" (??$?0V?$bind_t@XV?$mf0@XVGPUWorker@@@_mfi@boost@@V?$list1@V?$value@PEAVGPUWorker@@@_bi@boost@@@_bi@3@@_bi@boost@@@thread@boost@@QEAA@V?$bind_t@XV?$mf0@XVGPUWorker@@@_mfi@boost@@V?$list1@V?$value@PEAVGPUWorker@@@_bi@boost@@@_bi@3@@_bi@1@@Z)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "bool __cdecl boost::this_thread::interruptible_wait(void *,struct boost::detail::timeout)" (?interruptible_wait@this_thread@boost@@YA_NPEAXUtimeout@detail@2@@Z) referenced in function "protected: bool __cdecl boost::detail::basic_condition_variable::do_wait<class boost::unique_lock<class boost::mutex> >(class boost::unique_lock<class boost::mutex> &,struct boost::detail::timeout)" (??$do_wait@V?$unique_lock@Vmutex@boost@@@boost@@@basic_condition_variable@detail@boost@@IEAA_NAEAV?$unique_lock@Vmutex@boost@@@2@Utimeout@12@@Z)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::thread::~thread(void)" (??1thread@boost@@QEAA@XZ) referenced in function "public: void * __cdecl boost::thread::`scalar deleting destructor'(unsigned int)" (??_Gthread@boost@@QEAAPEAXI@Z)
1>../../bin/win64/Debug/simpleMultiGPU.exe : fatal error LNK1120: 11 unresolved externals

I've had linker trouble in the past but this time it seems much worst ;(
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now