User forums > Using Code::Blocks
undefined reference to fuctions in my library
lirong:
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,
MortenMacFly:
--- Quote from: lirong on August 16, 2007, 05:34:39 am ---I got errors about undefined reference to functions of libproject. How can I solve this problem?
--- End quote ---
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.
lirong:
I tried add "../bin/Debug" to linker search path, and added "project" to "Link Library". Now I get "/usr/bin/ld: connot find -lproject".
dje:
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
lirong:
The output is something like "foo.so"
Navigation
[0] Message Index
[#] Next page
Go to full version