Thanks again. I think I know where I've gone wrong now... :oops: Though I might still need help to fix it.
If you start C::B from a console with the -d parameter:
you should have an additional tab in "Logs & others" called "Code::Blocks Debug".
After opening your project you can onspect it and see, whether there is an entry like:
Caching result of `root-config --cflags --libs`
Cached
You can also try to run the command from the pre- or pos-build steps of the program (without the backticks), to see the output of it, if it is run in the context of C::B.
If it has an error, C::B will cache nothing and expand the backticked command to ... nothing.
So I did that and the build process worked fine... Then I started a new Terminal window and tried again - this time it didn't work. Then I remembered that for my first Terminal window, the one where I normally work from, I manually run a script to set up the environment:
. /home/jasper/gate/root_5.28.00e/bin/thisroot.sh
I would have thought that that sets the variables for everything else, but it appears to only affect the current Terminal window (and apparently applications launched from it). And normally I start C::B from the launcher...
This line appears under the "Code::Blocks Debug" tab in both cases:
Caching result of `root-config --cflags --libs`
Cached
but with nothing else that I can see that indicates success or failure. (Am I looking in the wrong place?)
When successful, `root-config --cflags --libs` expands normally.
New question then, is it possible to get C::B to run the script before calling g++? I'm making the assumption that C::B is internally creating it's own "session" to do the compile and link. I've tried adding the above script command to
Project -> Build options... -> [Project name] -> [GNU GCC Compiler] -> Pre/post build steps -> Pre-build steps
but the build fails, and the build log shows:
Running project pre-build steps
. /home/jasper/gate/root_5.28.00e/bin/thisroot.sh
/home/jasper/gate/root_5.28.00e/bin/thisroot.sh: 25: Bad substitution
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings
Removing the leading ". " I get:
Running project pre-build steps
/home/jasper/gate/root_5.28.00e/bin/thisroot.sh
/bin/sh: /home/jasper/gate/root_5.28.00e/bin/thisroot.sh: Permission denied
Process terminated with status 126 (0 minutes, 0 seconds)
0 errors, 0 warnings