Page 1 of 1

The project doesn't recognize libraries

Posted: Fri Aug 21, 2020 12:47 pm
by lionking
I have a solution which contains two static libraries, and one application.
I am trying to link the two static libraries with that application but always it doesn't recognize libraries and show me that message:

Image

Image

And here are my settings:

Image

Also, the library files in this way:

Image


Note that I am using ubuntu + Codelite v14.0.2.

How to solve that problem?

Re: The project doesn't recognize libraries

Posted: Fri Aug 21, 2020 1:14 pm
by DavidGH
Hi,

It would be far easier to answer this sort of question if you would attach a tarball of your failing Project, so that we can test it. Or, if you prefer, alter one of the template projects supplied by CodeLite so that it fails in the same way.

Guesses:
  • Does /home/lionking/myProjects/<BlurredOutPath>/build-Debug/bin/AppTest exist on the file system? Your first screenshot suggests it doesn't.
  • Does <BlurredOutPath> contain spaces? If so, either remove them or create a symlink work-around.
  • In the second screenshot, what is the full line that starts with '/usr/bin/g++ -o ' (the one above 'cannot find -lcore') ?
Regards,

David

Re: The project doesn't recognize libraries

Posted: Fri Aug 21, 2020 3:41 pm
by Jarod42
Shouldn't the output libraries be named libfile.a libcore.a?

Re: The project doesn't recognize libraries

Posted: Sat Aug 22, 2020 12:58 am
by lionking
DavidGH wrote:
Fri Aug 21, 2020 1:14 pm
Does /home/lionking/myProjects/<BlurredOutPath>/build-Debug/bin/AppTest exist on the file system? Your first screenshot suggests it doesn't.
The path is existing but the executable application itself does not exist because when compiling the two static libraries succeed but the executable application fails because it couldn't find the libraries' files "(see picture 2)" although the libraries files have been compiled successfully.
DavidGH wrote:
Fri Aug 21, 2020 1:14 pm
Does <BlurredOutPath> contain spaces? If so, either remove them or create a symlink work-around.
No, there are no spaces in the entire path, BlurredOutPath is like this "word-world".
DavidGH wrote:
Fri Aug 21, 2020 1:14 pm
In the second screenshot, what is the full line that starts with '/usr/bin/g++ -o ' (the one above 'cannot find -lcore') ?

Code: Select all

--------Building project:[ AppTest - Debug ]----------
make[1]: Entering directory '/home/lionking/MyProjects/BlurredOutPath/AppTest'
/usr/bin/g++ -o ../build-Debug/bin/AppTest @../build-Debug/AppTest/ObjectsList.txt -L/home/lionking/MyProjects/BlurredOutPath/build-Debug/lib -lcore -lfile
usr/bin/ld: cannot find -lcore
/usr/bin/ld: cannot find -lfile

Re: The project doesn't recognize libraries

Posted: Sat Aug 22, 2020 1:09 am
by lionking
Jarod42 wrote:
Fri Aug 21, 2020 3:41 pm
Shouldn't the output libraries be named libfile.a libcore.a?
I already did it as follow:

Image

But there are error messages appear something like

Code: Select all

undefined reference to `az::Binary::Binary(unsigned long)'
undefined reference to `az::Binary::Length()'
............

Re: The project doesn't recognize libraries

Posted: Sat Aug 22, 2020 4:43 am
by Jarod42
Where are `az::Binary::Binary(unsigned long)` defined? Are you sure you have implemented them?
From which project error comes from (core/file/appTest)

Re: The project doesn't recognize libraries

Posted: Sat Aug 22, 2020 5:04 am
by lionking
Jarod42 wrote:
Sat Aug 22, 2020 4:43 am
Where are `az::Binary::Binary(unsigned long)` defined? Are you sure you have implemented them?
From which project error comes from (core/file/appTest)
  • "Binary" is one of the classes that related to the "core" project (static library). it has .h and .cpp files and has been implemented too.
  • The errors come from "AppTest" project.

Re: The project doesn't recognize libraries

Posted: Sat Aug 22, 2020 1:19 pm
by DavidGH
It might be a problem with how you enter the library names.

I just created a new GUI template project, 'StaticlibLinking'. It doesn't need a static lib, but I'm telling the linker to add one anyway: one from an old wx3.0.3 static build. Its filepath is /home/david/devel/wxWidgets-3.0.3/udb3static/lib/libwxscintilla-3.0.a

So I've put '/home/david/devel/wxWidgets-3.0.3/udb3static/lib/' in the Libraries Search Path field, and tried different library names in the Libraries field.
StaticLinking.png

Entering either wxscintilla-3.0.a or wxscintilla-3.0 built successfully,

Code: Select all

/usr/bin/g++ -o ../build-Debug/bin/StaticlibLinking @../build-Debug/StaticlibLinking/ObjectsList.txt -L. -L/home/david/devel/wxWidgets-3.0.3/udb3static/lib/  -lwxscintilla-3.0  -L/usr/lib/x86_64-linux-gnu -pthread   -lwx_gtk2u_unofficial_xrc-3.1 -lwx_gtk2u_unofficial_html-3.1 -lwx_gtk2u_unofficial_qa-3.1 -lwx_gtk2u_unofficial_core-3.1 -lwx_baseu_unofficial_xml-3.1 -lwx_baseu_unofficial_net-3.1 -lwx_baseu_unofficial-3.1
but the linker could not find wxscintilla.

What are the actual names of your two static libraries? And what do you call them in the Libraries field?

Re: The project doesn't recognize libraries

Posted: Sat Aug 22, 2020 8:57 pm
by lionking
What are the actual names of your two static libraries? And what do you call them in the Libraries field?
Image


Image

Re: The project doesn't recognize libraries

Posted: Sat Aug 22, 2020 10:56 pm
by DavidGH
So they really are 'core' and 'file', rather than libcore, libfile (or libcore.a etc). As Jarod42 sensibly implied, it is normal for the name of a static lib to start with lib and end in .a.

Testing here, I renamed libwxscintilla-3.0.a to wxscintilla and put that in the 'Libaries' field. It failed to link, probably because the linker was automatically prepending 'lib'.

I suggest you rename the two static libraries as above, and try again.