View Full Version : I want to disable compile optimisation linux gcc

April 16th, 2012, 08:19 PM
I don't know if this forums accept programming Question , so if one know please tell me that

I want to disable compile optimisation in linux gcc compiler and then debug that code with eclipse cdt , any one know how to do that ?

April 16th, 2012, 10:55 PM
Moved to Packaging and Compiling Programs

April 16th, 2012, 11:56 PM
The option to pass to gcc is '-O0'. That's minus, capital-O, zero. But that's the default for gcc anyway, unless the build settings in Eclipse overrride it with -O1, -O2, etc.

April 17th, 2012, 12:58 AM
I have imported my project in eclipse using new --> make file project from existing resource

so I have Question , DO I have to go to make file and edit it or go to eclipse and then to project properties .

My project is SphinxTrain which is open source project available at

April 17th, 2012, 10:47 AM
In that case, the setting is probably in the Makefile.

If it's using GNU autotools be careful where you make the change because the Makefile may be generated. You'll know it is if you have configure.in, Makefile.am, etc.

April 18th, 2012, 02:25 PM
thamks r-senior I use
configure CFLAG '-O0' CXXFLAF '-O0' , and the optimisation become less than before , but I still have the following problems


please help me

April 18th, 2012, 02:54 PM
configure CFLAG '-O0' CXXFLAF '-O0'
That should be ./configure CFLAGS='-O0 -ggdb3' CXXFLAGS='-O0 -ggdb3' and make sure there is no space around the '='. Make sure you do a full rebuild after this (make clean; make).

April 18th, 2012, 03:07 PM
oh sorry this is the command that I used

./configure CXXFLAGS='-g -O0' CFLAGS='-g -O0'
what is the difference between this command and

./configure CFLAGS='-O0 -ggdb3' CXXFLAGS='-O0 -ggdb3' note : I choose linux GCC from toolchain when I make project with eclipse

April 18th, 2012, 03:12 PM
I use
./configure CFLAGS='-O0 -ggdb3' CXXFLAGS='-O0 -ggdb3'
but I still see variable without values and eclipse show me optimized out , it there any additional steps to do in eclipse?

April 19th, 2012, 07:16 PM
please don't open two threads on the same subject, the answer has been posted here:

April 20th, 2012, 06:12 AM
thank you MadCow108