Solved

Visual Studio & Boost C++ build problem

Posted on 2008-10-25
6
2,243 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…

730 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