User forums > General (but related to Code::Blocks)
When does C::B use mingw32-gcc.exe , compared with mingw32-g++.exe ?
Mountaingod:
Or to put it another way, how does Code::Blocks choose between them when compiling?
I have the GNU GCC Compiler selected as default, but both the above .exe s are listed under Compiler & Debugger Settings > Toolchain Executables .
I'm writing 'pure C' code, which both gcc and g++ can compile. I want to be sure gcc gets used however, so that errors are thrown should any non-C (i.e. C++) creep in.
Does it detect the language automatically - by file extension, parsing, etc. - or can I tell C::B which to use for a given project? This was not clear from the manual or user wiki.
oBFusCATed:
Yes, it uses the file extension -> .c - pure C, .cpp,.C,c++,cxx -> C++
Jenna:
--- Quote from: oBFusCATed on March 21, 2010, 12:55:30 pm ---Yes, it uses the file extension -> .c - pure C, .cpp,.C,c++,cxx -> C++
--- End quote ---
The capital C as file-ending is detected as c-file also !!
Mountaingod:
Thanks, that's what I needed.
I assume C::B decides based on the extensions of every file in a project? If so, does it make any decisions based on '.h' files? I would guess not, except that my last development tool (Notepad++) in fact did this (adopting C++, rather than C, syntax highlighting which I kept needing to correct). So it's worth me making sure!
rcoll:
--- Quote from: Mountaingod on March 21, 2010, 02:12:02 pm ---Thanks, that's what I needed.
I assume C::B decides based on the extensions of every file in a project? If so, does it make any decisions based on '.h' files? I would guess not, except that my last development tool (Notepad++) in fact did this (adopting C++, rather than C, syntax highlighting which I kept needing to correct). So it's worth me making sure!
--- End quote ---
Files ending with ".h" are not normally compiled directly -- they are included as part of another source file (that does end with ".c" or "cpp" or whatever). Therefore C::B doesn't need to decide which compiler to call for a *.h file.
However, the editor does do syntax highlighting based upon the file extension; in this case all C/C++ files are treated the same. But the editor does not do compiling -- it just edits.
Ringo
Navigation
[0] Message Index
[#] Next page
Go to full version