views:

52

answers:

1

I installed boost on cygwin, and tried to compile the following program:

#include <iostream>
#include <boost/thread/thread.hpp>

using namespace std;

void hello() {
  cout << "Hello cworld" << endl;
}
int main() {
  boost::thread t(hello);
  t.join();
}

via

$ g++ test.cpp -lboost_thread
/usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status

and get the above error. What should I be doing differently?

+1  A: 

Specify the Boost library path using -L option and then specify the -l option. Or Add the Boost lib path to LD_LIBRARY_PATH

Raghuram
The Boost lib path being Boost/Stage/Lib
Armen Tsirunyan