Solved

Visual Studio & Boost C++ build problem

Posted on 2008-10-25
6
2,235 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
ID: 22804103
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
ID: 22804948
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
ID: 22806448
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 17

Expert Comment

by:CSecurity
ID: 22806454
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
ID: 22821682
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
ID: 22847414
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

825 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