Linking problems

CodeLite installation/troubleshooting forum
johannes
CodeLite Enthusiast
Posts: 10
Joined: Tue Jul 26, 2011 9:33 am
Genuine User: Yes
IDE Question: c++
Contact:

Linking problems

Post by johannes »

Problem 1: library settings are not passed to the linker correctly.
To reproduce:
- create a new "Executable (G++)" project
- under "Project Settings -> Global Settings", enter several libraries (like "SDL GL GLU")
- build the project

The build will fail. This is an example build window output:

Code: Select all

----------Build Started--------
/bin/sh -c '"make"  -j 2 -f "gridfire_wsp.mk"'
----------Building project:[ gridfire - Debug ]----------
make[1]: Entering directory `/home/johannes/code/tests/gridfire'
g++ -o ./Debug/gridfire ./Debug/main.o  -L.  -lSDL GL GLU  
g++: GL: No such file or directory
g++: GLU: No such file or directory
make[1]: *** [Debug/gridfire] Error 1
make[1]: Leaving directory `/home/johannes/code/tests/gridfire'
make: *** [All] Error 2
----------Build Ended----------
0 errors, 0 warnings
The command line

Code: Select all

g++ -o ./Debug/gridfire ./Debug/main.o  -L.  -lSDL GL GLU 
should read

Code: Select all

g++ -o ./Debug/gridfire ./Debug/main.o  -L.  -lSDL -lGL -lGLU 
Problem 2: Build errors are not detected. After any linker error, the Build tab shows "0 Errors, 0 Warnings", even though there was an error and the project has not been built. The Errors tab then shows "Build ended successfully". The "Run" command will try to start the executable after that.

Both are always reproducible. Tested with v2.10.4778 installed from Ubuntu repository as well as binaries built from SVN trunk (Revision 5008). Running Ubuntu 11.04 x86 32-bit.
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Linking problems

Post by DavidGH »

Hi,
under "Project Settings -> Global Settings", enter several libraries (like "SDL GL GLU")
Or under "Project Settings > Common Settings > Linker", which I think is more often appropriate.
You're entering the libs separated by space. You need instead to do: "SDL;GL;GLU", which should really be mentioned in a tooltip...
Problem 2: Build errors are not detected
They are, but not reported correctly in the 'Errors' pane; and in 2.10.4778, by default, the Errors pane gets focus at the end of a build. In the latest trunk this no longer happens by default, so you get to see the real output of the build.

You can change this behaviour in 2.10.4778 from Settings > Build Settings > Build Output Appearance > Always show error pane after build.

Regards,

David
johannes
CodeLite Enthusiast
Posts: 10
Joined: Tue Jul 26, 2011 9:33 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: Linking problems

Post by johannes »

DavidGH wrote: You're entering the libs separated by space. You need instead to do: "SDL;GL;GLU", which should really be mentioned in a tooltip...
Thanks, that works.
Problem 2: Build errors are not detected
They are, but not reported correctly in the 'Errors' pane; and in 2.10.4778, by default, the Errors pane gets focus at the end of a build. In the latest trunk this no longer happens by default, so you get to see the real output of the build.

You can change this behaviour in 2.10.4778 from Settings > Build Settings > Build Output Appearance > Always show error pane after build.
No, in this case, they are not detected.

If you "Build and Run", and there is a build error, there will be a message box asking you for confirmation if you want to run the program anyway.

If there is a build error because of invalid linker command line as described, there will be no confirmation message box, and the executable will be started as if the build had succeeded.

Try it.
Post Reply