Vense
asked on
Visual Studio & Boost C++ build problem
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.
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
ASKER
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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@@QEAAX XZ) referenced in function "public: __cdecl GPUWorker::~GPUWorker(void )" (??1GPUWorker@@QEAA@XZ)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::thread_resource_err or::thread _resource_ error(void )" (??0thread_resource_error@ boost@@QEA A@XZ) referenced in function "void * __cdecl boost::detail::win32::crea te_anonymo us_event(e num boost::detail::win32::even t_type,enu m boost::detail::win32::init ial_event_ state)" (?create_anonymous_event@w in32@detai l@boost@@Y APEAXW4eve nt_type@12 3@W4initia l_event_st ate@123@@Z )
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl boost::thread_resource_err or::~threa d_resource _error(voi d)" (??1thread_resource_error@ boost@@UEA A@XZ)
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual char const * __cdecl boost::thread_resource_err or::what(v oid)const " (?what@thread_resource_err or@boost@@ UEBAPEBDXZ )
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl boost::thread_exception::~ thread_exc eption(voi d)" (??1thread_exception@boost @@UEAA@XZ) referenced in function "public: virtual void * __cdecl boost::thread_exception::` scalar deleting destructor'(unsigned int)" (??_Gthread_exception@boos t@@UEAAPEA XI@Z)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::lock_error::lock_er ror(void)" (??0lock_error@boost@@QEAA @XZ) referenced in function "public: void __cdecl boost::unique_lock<class boost::mutex>::lock(void)" (?lock@?$unique_lock@Vmute x@boost@@@ boost@@QEA AXXZ)
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl boost::lock_error::~lock_e rror(void) " (??1lock_error@boost@@UEAA @XZ)
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual char const * __cdecl boost::lock_error::what(vo id)const " (?what@lock_error@boost@@U EBAPEBDXZ)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "private: void __cdecl boost::thread::start_threa d(void)" (?start_thread@thread@boos t@@AEAAXXZ ) referenced in function "public: __cdecl boost::thread::thread<clas s boost::_bi::bind_t<void,cl ass boost::_mfi::mf0<void,clas s GPUWorker>,class boost::_bi::list1<class boost::_bi::value<class GPUWorker *> > > >(class boost::_bi::bind_t<void,cl ass boost::_mfi::mf0<void,clas s GPUWorker>,class boost::_bi::list1<class boost::_bi::value<class GPUWorker *> > >)" (??$?0V?$bind_t@XV?$mf0@XV GPUWorker@ @@_mfi@boo st@@V?$lis t1@V?$valu e@PEAVGPUW orker@@@_b i@boost@@@ _bi@3@@_bi @boost@@@t hread@boos t@@QEAA@V? $bind_t@XV ?$mf0@XVGP UWorker@@@ _mfi@boost @@V?$list1 @V?$value@ PEAVGPUWor ker@@@_bi@ boost@@@_b i@3@@_bi@1 @@Z)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "bool __cdecl boost::this_thread::interr uptible_wa it(void *,struct boost::detail::timeout)" (?interruptible_wait@this_ thread@boo st@@YA_NPE AXUtimeout @detail@2@ @Z) referenced in function "protected: bool __cdecl boost::detail::basic_condi tion_varia ble::do_wa it<class boost::unique_lock<class boost::mutex> >(class boost::unique_lock<class boost::mutex> &,struct boost::detail::timeout)" (??$do_wait@V?$unique_lock @Vmutex@bo ost@@@boos t@@@basic_ condition_ variable@d etail@boos t@@IEAA_NA EAV?$uniqu e_lock@Vmu tex@boost@ @@2@Utimeo ut@12@@Z)
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::thread::~thread(voi d)" (??1thread@boost@@QEAA@XZ) referenced in function "public: void * __cdecl boost::thread::`scalar deleting destructor'(unsigned int)" (??_Gthread@boost@@QEAAPEA XI@Z)
1>../../bin/win64/Debug/si mpleMultiG PU.exe : fatal error LNK1120: 11 unresolved externals
I've had linker trouble in the past but this time it seems much worst ;(
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: void __cdecl boost::thread::join(void)"
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::thread_resource_err
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl boost::thread_resource_err
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual char const * __cdecl boost::thread_resource_err
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl boost::thread_exception::~
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::lock_error::lock_er
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl boost::lock_error::~lock_e
1>GPUWorker.obj : error LNK2001: unresolved external symbol "public: virtual char const * __cdecl boost::lock_error::what(vo
1>GPUWorker.obj : error LNK2019: unresolved external symbol "private: void __cdecl boost::thread::start_threa
1>GPUWorker.obj : error LNK2019: unresolved external symbol "bool __cdecl boost::this_thread::interr
1>GPUWorker.obj : error LNK2019: unresolved external symbol "public: __cdecl boost::thread::~thread(voi
1>../../bin/win64/Debug/si
I've had linker trouble in the past but this time it seems much worst ;(
#pragma comment(lib, "BOOSTLIBNAMEHERE.LIB")
You need to add it after your #includes