Page 1 of 1

Precompiled Headers

Posted: Fri Sep 23, 2011 12:22 pm
by ndivner
Hi,

I am using CodeLite 3.0.5041 on WinXP SP3 and Codesourcery Toolchain for ARM Cortex M3

I have added Codesourcery compilers to the Build Settings.

My projects are all ANSI C ie no C++ but when compiling the header file CodeLite insists on using the arm-none-eabi-g++ compiler
instead of the project selected compiler which is arm-none-eabi-gcc.

I would also like to be able to use the arm-none-eabi-g++ compiler to compile files with a .c extension but CodeLite will not
allow this and will call arm-none-eabi-gcc instead.

Best regards,

Noel Diviney.

Re: Precompiled Headers

Posted: Fri Sep 23, 2011 2:03 pm
by eranif
ndivner wrote:instead of the project selected compiler which is arm-none-eabi-gcc.
Can you please attach your build_settings.xml file? (located under %appdata%\CodeLite\config)

In general, codelite uses 2 main compiler macros in its generated makefiles:
$(CompilerName)
and
$(C_CompilerName)

The first macro is expanded to the value set in the "Settings | Build Settings | <Compiler Name> | Tools | C++ compiler name" and the later is expanded to the value
set in "Settings | Build Settings | Compilers | <Compiler Name> | Tools | C compiler name"

By default codelite uses $(CompilerName) for all .cpp/.c++/.cxx files and $(C_CompilerName) to .c files.
To change this you can modify the build command line pattern from:
"Settings | Build Settings | Compilers | <Compiler Name> | File Types"
Select the extension you want to modify (i.e. "c") and replace $(C_CompilerName) with $(CompilerName)

Eran

Re: Precompiled Headers

Posted: Sat Sep 24, 2011 5:43 am
by ndivner
Hi Eran,

Thank you for the prompt response and taking the time to look at this for me.

I have attached PrecompiledHeaders.zip to provide details of whats happening.
In addition to the Project files I have also included the CodeLite Directory from C:\Documents & Settings.
Look in the zip for a subdirectory called "codelite".
The root directory of the zip file also has "BuildLog.txt" which is the output from a build run.
By default codelite uses $(CompilerName) for all .cpp/.c++/.cxx files and $(C_CompilerName) to .c files.
To change this you can modify the build command line pattern from:
"Settings | Build Settings | Compilers | <Compiler Name> | File Types"
Select the extension you want to modify (i.e. "c") and replace $(C_CompilerName) with $(CompilerName)
Thank you for the tip on overriding the default compiler selection.

Best regards,

Noel.

Re: Precompiled Headers

Posted: Sat Sep 24, 2011 8:40 am
by eranif
It looks like that codelite will always use the $(CompilerName) macro for the pre-compiled header
however, if your project is pure 'C' you can simply override the value set for this macro in the "Settings | Build Settings | Compilers | <compiler name> | Tools | C++ compiler name"

I will look into it (in any case, the fix will be part of the svn)
Eran

Re: Precompiled Headers

Posted: Sat Sep 24, 2011 9:37 am
by ndivner
Thank you Eran.

I will do as you suggest.

I love the IDE. It is working very nicely with Openocd for embedded development.

Best regards,

Noel.