Boost logo

Boost Users :

Subject: [Boost-users] error while loading shared libraries
From: ChristinaDRS (mail_at_[hidden])
Date: 2009-04-22 12:42:09


Greetings all,

I first created a class for a library like this:

library.h:

class Library
{
public:
   Library() { };
   ~Library() { };
   void testLib();
};

library.cpp:

#include "library.h"
#include <boost/thread/mutex.hpp>
#include <boost/thread.hpp>
#include <iostream>
using namespace std;

void Library::testLib()
{
   boost::thread* lt;
   boost::mutex mu;

   boost::mutex::scoped_lock lock(mu);
   cout << "test!" << endl;
}

I then created the static library like so:

g++ -I ~/boost_1_38_0/ -c library.cpp
ar rcs libtest.a library.o

and then I created a main.cpp like so:

#include "library.h"
#include <iostream>
using namespace std;

int main()
{
   Library l;
   l.testLib();
}

now when I try to compile main.cpp like this:

$ g++ -I ~/boost_1_38_0/ -I. main.cpp -o main -L/usr/local/lib/ -L. -ltest
-lboost_thread-gcc41-

now when I run main:

$ ./main
./main: error while loading shared libraries:
libboost_thread-gcc41-mt-1_38.so.1.38.0: cannot open shared object file: No
such file or directory

I get that error.

Can anyone explain why?

-- 
View this message in context: http://www.nabble.com/error-while-loading-shared-libraries-tp23175557p23175557.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net