Solved

Visual Studio & Boost C++ build problem

Posted on 2008-10-25
6
2,261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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 technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

726 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