Hi
I am noob to XCODE C++. I am trying to use Boost library. The boost library was installed by MACPort. Once loading is done, I create a c++ project from Xcode. The is some code below:
#include <iostream>
#include <boost/thread.hpp>
void task1() {
// do stuff}
void task2() {
// do stuff}
int main (int argc, const char * argv[])
{
using namespace boost;
thread thread_1 = thread(task1);
thread thread_2 = thread(task2);
// do other stuff
thread_2.join();
thread_1.join();
return 0;
}
since boost library is stored in /opt/local/include/boost, "Header Search Path" is set to "/opt/local/include" and "Library Search Paths" was set to"/opt/local/bin." But When the main is built, I got some error and couldn't figure out. The error was shown below.
ld: warning: directory not found for option '-L/opt/ocal/bin'
Undefined symbols for 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 for boost::detail::thread_data_base", referenced from:
boost::detail::thread_data_base::thread_data_base() in main.o
NOTE: a missing vtable usually means the 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 for boost::detail::thread_data_base", referenced from:
typeinfo for boost::detail::thread_data<void (*)()> in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation
Can any one suggest how to fix?
And please suggest how to set external library?
Thanks
I am noob to XCODE C++. I am trying to use Boost library. The boost library was installed by MACPort. Once loading is done, I create a c++ project from Xcode. The is some code below:
#include <iostream>
#include <boost/thread.hpp>
void task1() {
// do stuff}
void task2() {
// do stuff}
int main (int argc, const char * argv[])
{
using namespace boost;
thread thread_1 = thread(task1);
thread thread_2 = thread(task2);
// do other stuff
thread_2.join();
thread_1.join();
return 0;
}
since boost library is stored in /opt/local/include/boost, "Header Search Path" is set to "/opt/local/include" and "Library Search Paths" was set to"/opt/local/bin." But When the main is built, I got some error and couldn't figure out. The error was shown below.
ld: warning: directory not found for option '-L/opt/ocal/bin'
Undefined symbols for 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 for boost::detail::thread_data_base", referenced from:
boost::detail::thread_data_base::thread_data_base() in main.o
NOTE: a missing vtable usually means the 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 for boost::detail::thread_data_base", referenced from:
typeinfo for boost::detail::thread_data<void (*)()> in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation
Can any one suggest how to fix?
And please suggest how to set external library?
Thanks