Reputation: 33
Im using a Windows 7 Premium 64 bit laptop to compile programs using the Boost libraries.
I followed this link for boost installation : How to use Boost in Visual Studio 2010
Now I am getting this error when I hit compile. What is the cause of this?
I have include the header file
#include <boost/thread.hpp>
I am only using thread, mutex and condition_variable for the boost part. I am getting this error when I try to compile the program.
1> All outputs are up-to-date.
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "public: __thiscall boost::thread_exception::thread_exception(int,char const *)" (??0thread_exception@boost@@QAE@HPBD@Z)
1>ThreadedFileWriter.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category@system@boost@@YAABVerror_category@12@XZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (__imp_?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??__Eposix_category@system@boost@@YAXXZ)
1>ThreadedFileWriter.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (__imp_?generic_category@system@boost@@YAABVerror_category@12@XZ)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::thread::~thread(void)" (__imp_??1thread@boost@@QAE@XZ) referenced in function "public: __thiscall KThreadedFileWriter::KThreadedFileWriter(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (??0KThreadedFileWriter@@QAE@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class boost::thread & __thiscall boost::thread::operator=(class boost::thread &&)" (__imp_??4thread@boost@@QAEAAV01@$$QAV01@@Z) referenced in function "public: __thiscall KThreadedFileWriter::KThreadedFileWriter(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (??0KThreadedFileWriter@@QAE@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::thread::thread(void)" (__imp_??0thread@boost@@QAE@XZ) referenced in function "public: __thiscall KThreadedFileWriter::KThreadedFileWriter(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (??0KThreadedFileWriter@@QAE@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::detail::win32::handle_manager::handle_manager(void *)" (__imp_??0handle_manager@win32@detail@boost@@QAE@PAX@Z) referenced in function "public: __thiscall boost::detail::basic_condition_variable::basic_condition_variable(void)" (??0basic_condition_variable@detail@boost@@QAE@XZ)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::detail::win32::handle_manager::~handle_manager(void)" (__imp_??1handle_manager@win32@detail@boost@@QAE@XZ) referenced in function "public: __thiscall boost::detail::basic_condition_variable::~basic_condition_variable(void)" (??1basic_condition_variable@detail@boost@@QAE@XZ)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class boost::detail::win32::handle_manager & __thiscall boost::detail::win32::handle_manager::operator=(void *)" (__imp_??4handle_manager@win32@detail@boost@@QAEAAV0123@PAX@Z) referenced in function "public: void __thiscall boost::detail::basic_condition_variable::notify_all(void)" (?notify_all@basic_condition_variable@detail@boost@@QAEXXZ)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::detail::win32::handle_manager::operator void *(void)const " (__imp_??Bhandle_manager@win32@detail@boost@@QBEPAXXZ) referenced in function "public: void __thiscall boost::detail::basic_cv_list_entry::release(unsigned int)" (?release@basic_cv_list_entry@detail@boost@@QAEXI@Z)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) private: void __thiscall boost::thread::start_thread(void)" (__imp_?start_thread@thread@boost@@AAEXXZ) referenced in function "public: __thiscall boost::thread::thread<void (__thiscall KThreadedFileWriter::*)(void),class KThreadedFileWriter *>(void (__thiscall KThreadedFileWriter::*)(void),class KThreadedFileWriter *,struct boost::thread::dummy *)" (??$?0P8KThreadedFileWriter@@AEXXZPAV0@@thread@boost@@QAE@P8KThreadedFileWriter@@AEXXZPAV2@PAUdummy@01@@Z)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::gregorian::greg_month::greg_month(unsigned short)" (__imp_??0greg_month@gregorian@boost@@QAE@G@Z) referenced in function "public: __thiscall boost::gregorian::date::date(enum boost::date_time::special_values)" (??0date@gregorian@boost@@QAE@W4special_values@date_time@2@@Z)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::gregorian::greg_month::operator unsigned short(void)const " (__imp_??Bgreg_month@gregorian@boost@@QBEGXZ) referenced in function "public: static unsigned int __cdecl boost::date_time::gregorian_calendar_base<struct boost::date_time::year_month_day_base<class boost::gregorian::greg_year,class boost::gregorian::greg_month,class boost::gregorian::greg_day>,unsigned int>::day_number(struct boost::date_time::year_month_day_base<class boost::gregorian::greg_year,class boost::gregorian::greg_month,class boost::gregorian::greg_day> const &)" (?day_number@?$gregorian_calendar_base@U?$year_month_day_base@Vgreg_year@gregorian@boost@@Vgreg_month@23@Vgreg_day@23@@date_time@boost@@I@date_time@boost@@SAIABU?$year_month_day_base@Vgreg_year@gregorian@boost@@Vgreg_month@23@Vgreg_day@23@@23@@Z)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) bool __cdecl boost::this_thread::interruptible_wait(void *,struct boost::detail::timeout)" (__imp_?interruptible_wait@this_thread@boost@@YA_NPAXUtimeout@detail@2@@Z) referenced in function "public: bool __thiscall boost::detail::basic_cv_list_entry::wait(struct boost::detail::timeout)" (?wait@basic_cv_list_entry@detail@boost@@QAE_NUtimeout@23@@Z)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall boost::detail::win32::handle_manager::operator!(void)const " (__imp_??7handle_manager@win32@detail@boost@@QBE_NXZ) referenced in function "private: class boost::intrusive_ptr<class boost::detail::basic_cv_list_entry> __thiscall boost::detail::basic_condition_variable::get_wait_entry(void)" (?get_wait_entry@basic_condition_variable@detail@boost@@AAE?AV?$intrusive_ptr@Vbasic_cv_list_entry@detail@boost@@@3@XZ)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void * __thiscall boost::detail::win32::handle_manager::duplicate(void)const " (__imp_?duplicate@handle_manager@win32@detail@boost@@QBEPAXXZ) referenced in function "public: __thiscall boost::detail::basic_cv_list_entry::basic_cv_list_entry(class boost::detail::win32::handle_manager const &)" (??0basic_cv_list_entry@detail@boost@@QAE@ABVhandle_manager@win32@12@@Z)
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall boost::detail::thread_data_base::~thread_data_base(void)" (__imp_??1thread_data_base@detail@boost@@UAE@XZ) referenced in function __unwindfunclet$??0?$thread_data@V?$bind_t@XV?$mf0@XVKThreadedFileWriter@@@_mfi@boost@@V?$list1@V?$value@PAVKThreadedFileWriter@@@_bi@boost@@@_bi@3@@_bi@boost@@@detail@boost@@QAE@$$QAV?$bind_t@XV?$mf0@XVKThreadedFileWriter@@@_mfi@boost@@V?$list1@V?$value@PAVKThreadedFileWriter@@@_bi@boost@@@_bi@3@@_bi@2@@Z$0
1>ThreadedFileWriter.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall boost::detail::thread_data_base::thread_data_base(void)" (__imp_??0thread_data_base@detail@boost@@QAE@XZ) referenced in function "public: __thiscall boost::detail::thread_data<class boost::_bi::bind_t<void,class boost::_mfi::mf0<void,class KThreadedFileWriter>,class boost::_bi::list1<classboost::_bi::value<class KThreadedFileWriter *> > > >::thread_data<class boost::_bi::bind_t<void,class boost::_mfi::mf0<void,class KThreadedFileWriter>,class boost::_bi::list1<class boost::_bi::value<class KThreadedFileWriter *> > > >(class boost::_bi::bind_t<void,class boost::_mfi::mf0<void,class KThreadedFileWriter>,class boost::_bi::list1<class boost::_bi::value<class KThreadedFileWriter *> > > &&)" (??0?$thread_data@V?$bind_t@XV?$mf0@XVKThreadedFileWriter@@@_mfi@boost@@V?$list1@V?$value@PAVKThreadedFileWriter@@@_bi@boost@@@_bi@3@@_bi@boost@@@detail@boost@@QAE@$$QAV?$bind_t@XV?$mf0@XVKThreadedFileWriter@@@_mfi@boost@@V?$list1@V?$value@PAVKThreadedFileWriter@@@_bi@boost@@@_bi@3@@_bi@2@@Z)
1>ThreadedFileWriter.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall boost::detail::thread_data_base::notify_all_at_thread_exit(class boost::condition_variable *,class boost::mutex *)" (?notify_all_at_thread_exit@thread_data_base@detail@boost@@UAEXPAVcondition_variable@3@PAVmutex@3@@Z)
1>E:\WorkspaceSrihare\DynamicMatrix\Problem5\Debug\Problem5.exe : fatal error LNK1120: 18 unresolved externals
1>
1>Build FAILED.
What is the error. I have made sure that the lib and headers are included in the properties of the project.
Upvotes: 0
Views: 2072
Reputation: 792
You need to link the binaries to your project, go to your project's properties, Linker, General, and give the address to the binary folder which you compiled boost into it (by default it is in stage directory in your boost's root folder). If this didn't work, try adding the full address to lib files related to thread in your project's properties, Linker, Input, Additional dependencies.
Upvotes: 1