By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,991 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,991 IT Pros & Developers. It's quick & easy.

C++ Compiler path error in Linix library (I think)

P: 12
I'm using C++ in a Linix environment to read from TCP and UDP sockets. I now need to start using multi-threading and we're using pthreads (i.e. pthread.h).

When I started including the pthread library I found that '#include <pthread.h>' doesn't function by itself, I needed to do the following to compile it.

[php]icc filename .cpp -lpthread[/php]

Fine as far as it goes, but now I need to include another library, since many of the functions I'm using need to be replaced. So 'select' becomes 'pth_select', 'sleep' becomes 'pth_sleep', etc. The new library is pth.h (i.e. #include <pth.h>)

The pth library is installed into the default location. I compile the program by the following line:

Expand|Select|Wrap|Line Numbers
  1. icc  filename.cpp -O2 -static-libcxa -static-libpth -lpthread -lpth -o filename.o
With the extra -l commands it compiles, but when I try to run it it says:

./filename.o: error while loading shared libraries: cannot open shared object file: No such file or directory

I'm more than a bit lost with this one and would appreciate any help. Thank you in advance.
Jun 13 '07 #1
Share this Question
Share on Google+
1 Reply

P: 12
Please ignore.

The solution is:

icc filename.cpp -O2 -lpth -lpthread -o filename.o
Jun 13 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.