Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: lirong on August 16, 2007, 05:34:39 am
-
Hi,
I have two project in one workspace. One is a shared library libproject. Another is a program using the library project-test. I have set the project dependency so that project-test depends on libproject. However, when I tried to build project-test, I got errors about undefined reference to functions of libproject. How can I solve this problem?
Regards,
-
I got errors about undefined reference to functions of libproject. How can I solve this problem?
You not only need the reference but you also (and most important) need to *link* against this library. Project dependencies is for the build order - that way the lib is built before the executable if it's sources are modified.
With regards, Morten.
-
I tried add "../bin/Debug" to linker search path, and added "project" to "Link Library". Now I get "/usr/bin/ld: connot find -lproject".
-
if your output is libfoo.a, you have to put foo in your linker libraries.
It has nothing to do with your project name, as your project name is not necessary used in output file.
Dje
-
The output is something like "foo.so"
-
Hi,
How can I show the command line of the compile/link?
Thanks
-
The project of the library is call libodlm. It's output is ../bin/Debug/odlm.so
The test project is called odlm-test. It's output is ../bin/Debug/odlm-test
Here is the full command line linking odlm-test:
g++ -L../bin/Debug -L/usr/lib -o ../bin/Debug/odlm-test ../obj/Debug/main.o -lodlm
And odlm.so is indeed in the folder ../bin/Debug
So... What's the problem?
-
The project of the library is call libodlm. It's output is ../bin/Debug/odlm.so
The test project is called odlm-test. It's output is ../bin/Debug/odlm-test
Hi,
Did you also create the import library?
if you did, then you can try to link with it(something like libodlm.a)
Good luck
-
*.so on Linux = *.dll on windows
import libraries are Windows specific and are one way to export symbols that can be used outside the dll.
Don't try to use import libraries on Linux.
Dje