Skip to content
Advertisement

/usr/bin/ld cannot find -l

I have written a few programs and while trying to compile them using g++,as thus,

JavaScript

I keep getting the following error:

JavaScript

fwlib32.h is the library I am trying to include. The shared object file libfwlib32.so is present in /usr/local/lib as well as /usr/lib. But I am unable link to it. I have tried all the solutions offered by similar questions including

$ export LIBRARY_PATH=/usr/local/lib/

$ export LD_LIBRARY_PATH=/usr/local/lib

I have done the above for /usr/lib as well, but still the same error. I have tried using the -L option in the command line but I still get the error.

I even created a new folder called lib, pasted libfwlib32.so.1.0.1 into it and ran

$ ln -s ~/lib/libfwlib32.so.1.0.1 ~/lib/libfwlib32.so

on the console to create a new .so file and gave ~/lib as argument to -L option on the command line. It made no difference. I am at the point of tearing my hair out so any help will be appreciated.

Thanks alot!

Advertisement

Answer

You should put -l option in the very last as:

JavaScript

Note: Please make sure that all the header and source file are in the same folder.

Advertisement