User forums > Using Code::Blocks

Passing command line options to compiler

(1/2) > >>

JasperC:
Hello all,

I'm a new to using Code::Blocks, so far I've been using gedit and the command line to compile my programs.  I'd like to move to CB, but I've run into a problem.  I'm running CB 10.05 on Ubuntu 11.04 x32, and my code makes use of ROOT.  To compile, I've been using the following at the Terminal:


--- Code: ---g++ mycode.c `root-config --cflags --libs`
--- End code ---

I'm currently stuck trying to pass that last bit to the compiler when using CB.  I've read this, and under

Project -> Build options... -> [Project name] -> [GNU GCC Compiler] -> Compiler settings -> Other options, and
Project -> Build options... -> [Project name] -> [GNU GCC Compiler] -> Linker settings -> Other linker options

I have added in


--- Code: ---`root-config --cflags --libs`
--- End code ---

However when I build the project, the build log shows that that arguement is not passed to g++.


Project -> Build options... -> [Project name] -> [GNU GCC Compiler] -> Compiler settings -> Other options
does have a "-fexceptions" already added, and that does get passed, so I'm not sure what could be wrong.  Advice would be appreciated, thanks!

Jenna:
The argument between the backticks will be expanded and the result is put into the commandline.
If you turn on full commandline logging ( http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_an_compiler_problem.3F ) , you should be able to see it.

JasperC:
Hi Jens,

Thanks for the reply.  Guess I wasn't that clear in my post, but I have read the FAQ and already turned on full commandline logging.  The problem is the backticks(?) argument does not appear in the commandline, either expanded or unexpanded.

There is already a "-fexceptions" option specified, and I can remove and restore that with the expected result.  My argument seems to be ignored however...

stahta01:
When you run the following on a command line, what is the result?

--- Code: ---root-config --cflags --libs

--- End code ---

JasperC:

--- Quote from: stahta01 on October 20, 2011, 04:54:37 am ---When you run the following on a command line, what is the result?

--- Code: ---root-config --cflags --libs

--- End code ---

--- End quote ---

I get

--- Code: ----pthread -m32 -I/home/jasper/gate/root_5.28.00e/include -L/home/jasper/gate/root_5.28.00e/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic

--- End code ---

So I know that part of it should work at least...

Navigation

[0] Message Index

[#] Next page

Go to full version