Wednesday, 10 February 2010

Can any one help with my problem??


hi

noob xcode c++. trying use boost library. boost library installed macport. once loading done, create c++ project xcode. code below:
#include <iostream>
#include <boost/thread.hpp>

void task1() {
// stuff}

void task2() {
// stuff}

int main (int argc, const char * argv[])
{

using namespace boost;
thread thread_1 = thread(task1);
thread thread_2 = thread(task2);

// other stuff
thread_2.join();
thread_1.join();
return 0;
}

since boost library stored in /opt/local/include/boost, "header search path" set "/opt/local/include" , "library search paths" set to"/opt/local/bin." when main built, got error , couldn't figure out. error shown below.
ld: warning: directory not found option '-l/opt/ocal/bin'
undefined symbols architecture x86_64:
"boost::thread::~thread()", referenced from:
_main in main.o
"boost::thread::join()", referenced from:
_main in main.o
"boost::thread::start_thread()", referenced from:
boost::thread::thread<void (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void (*&)(), boost::detail::thread_move_t<void (*)()> >, boost::thread::dummy*>::type) in main.o
"vtable boost::detail::thread_data_base", referenced from:
boost::detail::thread_data_base::thread_data_base() in main.o
note: missing vtable means first non-inline virtual member function has no definition.
"boost::detail::thread_data_base::~thread_data_base()", referenced from:
boost::detail::thread_data<void (*)()>::~thread_data() in main.o
"typeinfo boost::detail::thread_data_base", referenced from:
typeinfo boost::detail::thread_data<void (*)()> in main.o
ld: symbol(s) not found architecture x86_64
clang: error: linker command failed exit code 1 (use -v see invocation

can 1 suggest how fix?
, please suggest how set external library?

 

no, wasn't.

read first linker warning carefully.

bonus points including relevant information in post. many posters don't that, leading wild goose chase.
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment