preprocessing cpp file

General questions regarding the usage of CodeLite
rekisum
CodeLite Enthusiast
Posts: 27
Joined: Fri Apr 24, 2009 6:49 pm
Contact:

preprocessing cpp file

Post by rekisum »

Hi,

if I try right mouseclick 'Preprocess' in the Workspace view I get the following error:
  • ----------Build Started--------
    C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe" -j 1 -f "lcdsim.mk" ./Debug/lcdcomsource"
    ----------Building project:[ lcdsim - Debug ] (Preprocess Single File)----------
    cc Debug/lcdcomsource.o -o Debug/lcdcomsource
    process_begin: CreateProcess(NULL, cc Debug/lcdcomsource.o -o Debug/lcdcomsource, ...) failed.
    make (e=2): Das System kann die angegebene Datei nicht finden.
I need a little help here.
There is no cc.exe in the /mingw/bin.
There is a cc1.exe in mingw/libexec/gcc/mingw32/4.4.0/.
It looks like this is done by the makefile but I can't find a command like this.
Don't know where it's going wrong here.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: preprocessing cpp file

Post by eranif »

Did you touch the build settings of the compiler by any chance? codelite's makefiles are using gcc / g++ by default
Please check under 'Settings -> Build Settings' under gcc / g++ and see in the 'Tools' that the compiler is indeed g++ / gcc and not cc

Eran
Make sure you have read the HOW TO POST thread
rekisum
CodeLite Enthusiast
Posts: 27
Joined: Fri Apr 24, 2009 6:49 pm
Contact:

Re: preprocessing cpp file

Post by rekisum »

No, I didn't touch anything there.
Don't know who is calling cc, make?
Under cygwin cc is a symbol link to gcc.
So I copied gcc.exe to cc.exe.
No it works but I got a lot of errors:
  • ----------Build Started--------
    C:\WINDOWS\system32\cmd.exe /c ""mingw32-make.exe" -j 2 -f "lcdsim.mk" ./Debug/lcdcomsource"
    ----------Building project:[ lcdsim - Debug ] (Preprocess Single File)----------
    cc Debug/lcdcomsource.o -o Debug/lcdcomsource
    Debug/lcdcomsource.o: In function `lcdComSource':
    D:/Dateien/CrossWorks/icps-sw/src/lcdsim/lcdcomsource.cpp:8: undefined reference to `_imp___ZN12wxEvtHandlerC2Ev'
    D:/Dateien/CrossWorks/icps-sw/src/lcdsim/lcdcomsource.cpp:11: undefined reference to `operator new(unsigned int)'
    D:/Dateien/CrossWorks/icps-sw/src/lcdsim/lcdcomsource.cpp:11: undefined reference to `wxSerialPort::wxSerialPort()'
    D:/Dateien/CrossWorks/icps-sw/src/lcdsim/lcdcomsource.cpp:11: undefined reference to `operator delete(void*)'
    D:/Dateien/CrossWorks/icps-sw/src/lcdsim/lcdcomsource.cpp:21: undefined reference to `operator new(unsigned int)'
    ...
I don't understand the line: cc Debug/lcdcomsource.o -o Debug/lcdcomsource.
I would have expected something like: gcc -E Debug/lcdcomsource.cpp -o Debug/lcdcomsource.pp

Looks like you 're trying to preprocess an object file?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: preprocessing cpp file

Post by eranif »

rekisum wrote:Under cygwin cc is a symbol link to gcc.
Dont mix codelite and cygwin.
rekisum wrote:D:/Dateien/CrossWorks/icps-sw/src/lcdsim/lcdcomsource.cpp:8: undefined reference to `_imp___ZN12wxEvtHandlerC2Ev'
D:/Dateien/CrossWorks/icps-sw/src/lcdsim/lcdcomsource.cpp:11: undefined reference to `operator new(unsigned int)'
D:/Dateien/CrossWorks/icps-sw/src/lcdsim/lcdcomsource.cpp:11: undefined reference to `wxSerialPort::wxSerialPort()'
D:/Dateien/CrossWorks/icps-sw/src/lcdsim/lcdcomsource.cpp:11: undefined reference to `operator delete(void*)'
D:/Dateien/CrossWorks/icps-sw/src/lcdsim/lcdcomsource.cpp:21: undefined reference to `operator new(unsigned int)'
This is because you are comiling .cpp file with gcc - you should use g++
rekisum wrote:I would have expected something like: gcc -E Debug/lcdcomsource.cpp -o Debug/lcdcomsource.pp
Open 'Build settings' select the compiler you are using, and and then select the 'Switches' entry
Under it, make sure that the 'PreprocessOnly' switch is set to '-E ' (with the space)

Eran
Make sure you have read the HOW TO POST thread
rekisum
CodeLite Enthusiast
Posts: 27
Joined: Fri Apr 24, 2009 6:49 pm
Contact:

Re: preprocessing cpp file

Post by rekisum »

Dont mix codelite and cygwin.
I don't hope so ;-)
But I have cygwin installed and therefore could see the link.
This is because you are comiling .cpp file with gcc - you should use g++
Yes, this is an issue in my project.
For some weired reasons I have C and C++ code intermixed in my project.
Setting gcc as the build tool it compiles with some warnings.

Code: Select all

cc1.exe: warning: command line option "-Wno-ctor-dtor-privacy" is valid for C++/ObjC++ but not for C
What would be the preferred method in CL for a project with C and Cpp sources?
In a makefile I could choose the compiler for each source or group.
Maybe settings for virtual folders would be an interesting option?
Open 'Build settings' select the compiler you are using, and and then select the 'Switches' entry
Under it, make sure that the 'PreprocessOnly' switch is set to '-E ' (with the space)
Yes, now I get a file with an .i at the end. :D
I think that's what i wanted, though its hard to read....
Maybe you want to add the -E in the default settings?
Thanks!
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: preprocessing cpp file

Post by eranif »

rekisum wrote:Maybe settings for virtual folders would be an interesting option?
The correct fix is in the 'File Types' properties of the compiler, where each file extension has a unique build line.
The problem that currently there is a single macro named $(CompilerName), separating this to $(C_CompilerName) and $(Cpp_CompilerName) is the correct solution
rekisum wrote:Maybe you want to add the -E in the default settings?
I will
rekisum wrote:What would be the preferred method in CL for a project with C and Cpp sources?
Since only g++ can compiler both, I would choose g++

Eran
Make sure you have read the HOW TO POST thread
Post Reply