Page 1 of 1

preprocessing cpp file

Posted: Mon Nov 23, 2009 2:11 pm
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.

Re: preprocessing cpp file

Posted: Mon Nov 23, 2009 3:44 pm
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

Re: preprocessing cpp file

Posted: Mon Nov 23, 2009 4:29 pm
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?

Re: preprocessing cpp file

Posted: Mon Nov 23, 2009 5:04 pm
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

Re: preprocessing cpp file

Posted: Mon Nov 23, 2009 5:30 pm
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!

Re: preprocessing cpp file

Posted: Mon Nov 23, 2009 6:07 pm
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