--- In Boost-Users@y..., "imi123_1999"
This is my second post. In the last post i pointed out two errors out of which one is fixed but the other one is still there.
I am trying to build a sample program on threads in VC++. It compiles successfully but the linker gives errors of unresolved external symbols. Please tell me that what "changes" we've to make in VC++ 6 linker options. Please tell me clearly that in which dialog box of VC++ IDE we have to make changes and how and what changes we've to made. I am using boost 1_27_0. Program and errors are given below:
********************************************************
The program is:
#include
#include <iostream> int count = 0; boost::mutex mutex;
void increment_count() { boost::mutex::scoped_lock lock(mutex); std::cout << "count = " << ++count << std::endl; }
int main(int argc, char* argv[]) { boost::thread_group threads; for (int i = 0; i < 10; ++i) threads.create_thread(&increment_count); threads.join_all(); }
******************************************************** The errors i am getting are:
imi.obj : error LNK2001: unresolved external symbol "public: __thiscall boost::mutex::mutex(void)" (??0mutex@boost@@QAE@XZ)
imi.obj : error LNK2001: unresolved external symbol "public: __thiscall boost::mutex::~mutex(void)" (??1mutex@boost@@QAE@XZ)
imi.obj : error LNK2001: unresolved external symbol "public: __thiscall boost::thread_group::~thread_group(void)" (?? 1thread_group@boost@@QAE@XZ)
imi.obj : error LNK2001: unresolved external symbol "public: void __thiscall boost::thread_group::join_all(void)" (? join_all@thread_group@boost@@QAEXXZ)
imi.obj : error LNK2001: unresolved external symbol "public: class boost::thread * __thiscall boost::thread_group::create_thread(class boost::function0
const &)" (?crea te_thread@thread_group@boost@@QAEPAVthread@2@ABV?
$function0@XUempty_function_policy@boost@@Uempty_function_mixin@2@H@2@
@Z)
imi.obj : error LNK2001: unresolved external symbol "public: __thiscall boost::thread_group::thread_group(void)" (?? 0thread_group@boost@@QAE@XZ)
imi.obj : error LNK2001: unresolved external symbol "public: __thiscall boost::lock_error::lock_error(void)" (?? 0lock_error@boost@@QAE@XZ)
imi.obj : error LNK2001: unresolved external symbol "private: void __thiscall boost::mutex::do_lock(void)" (? do_lock@mutex@boost@@AAEXXZ)
imi.obj : error LNK2001: unresolved external symbol "private: void __thiscall boost::mutex::do_unlock(void)" (? do_unlock@mutex@boost@@AAEXXZ)
Debug/threadImI.exe : fatal error LNK1120: 9 unresolved externals Error executing link.exe.
threadImI.exe - 10 error(s), 0 warning(s)
Have you linked against libboost_thread.lib and boost_threadmon.dll? Bill Kempf