g++ boo_t.cpp -L../resource/boost_1_35_0/bin.v2/libs/thread/build/gcc-4.1.2/release/threading-multi/libboost_thread-gcc41-mt-1_35.so.1.35.0 -Lpthread<br /> boo_t.cpp: In function ‘void increment_count()’:<br /> boo_t.cpp:14: error: reference to ‘mutex’ is ambiguous<br /> boo_t.cpp:10: error: candidates are: boost::mutex mutex<br /> /usr/include/boost/thread/mutex.hpp:35: error: class boost::mutex<br /> <br /> code: <br /> #include <boost/thread.hpp><br /> #include <boost/thread/mutex.hpp><br /> #include <iostream><br /> <br /> using namespace std;<br /> using namespace boost;<br /> <br /> int count = 0;<br /> boost::mutex mutex;<br /> <br /> void increment_count()<br /> {<br /> boost::mutex::scoped_lock lock(mutex);<br /> std::cout << "count = " << ++count << std::endl;<br /> }<br /> <br /> int main(int argc, char* argv[])<br /> {<br /> boost::thread_group threads;<br /> for (int i = 0; i < 10; ++i)<br /> threads.create_thread(&increment_count);<br /> threads.join_all();<br /> "boo_t.cpp" 24L, 480C 1,1 Top<br /> <br /> c<hr style="border:dotted 1px silver; width:90%; border:dotted 1px silver;">Peisheng Wang<br /> Software Engineer<br /> iZENEsoft (Shanghai) Co., Ltd<br /> Room 601 Marine Tower, No. 1 Pudong Ave.<br /> Tel:86-21-68860698-114<br /> Fax:86-21-68860699<br /> Company Website:<a target="_blank" href="http://www.izenesoft.com/">www.izenesoft.com</a><br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <a href="../../../../index.php?menuaction=felamimail.uicompose.compose&send_to=Wmhlbi5ZdUBNb3JnYW5TdGFubGV5LmNvbQ=="><font color="blue">Zhen.Yu@MorganStanley.com</font></a>