User forums > Help

Code Blocks using wrong compiler [Linux]

(1/5) > >>

Taedrin:
Hello, I just installed Code Blocks via yum on Fedora Core 8.  I tried compiling a simple Hello World program, and I get the following error:

'"Test - Debug" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]. Skipping...'

After a bit of research, I found that inside the project files XML, the compiler is being set to "gcc", which is the C compiler.  I need this to be g++.  However, according to the compiler settings window (toolchain executable tab), the C++ compiler is set to g++.

So what the problem seems to be is that Code Blocks thinks that my hello world project is a C program.  And try as I might, I can find no project setting (or build target setting, for that matter) which flags the project as a C++ program, or tells it to use a C++ compiler.  I suppose a workaround would involve manually editing the project file and replacing all occurances of 'gcc' with 'g++', but I would really rather avoid editing automatically generated files.

Any suggestions on how to fix this?

killerbot:
in the cbp file it should say gcc, not g++.

Then it depends on the extension : main.cpp or main.c

Could you attach that test project ??

Taedrin:
Attached project files (and the hello world program too).

/edit: Renamed the files to have a .txt extension so that forums would allow them to be uploaded, and I'm too lazy to zip them together -.-

/edit2: After some fiddling around (closing code blocks, and restarting it while saving changes to projects), it added a line to the .cbd file:

'      <Unit filename="test.cpp" />'

However, this did nothing to solve my problem...

[attachment deleted by admin]

killerbot:
one thing I see in the cbp file, it has no units == there are no source files in the project !!!

Taedrin:
Check my edit above, it didn't put that into the cbd file until after I close the IDE and saved changes.  But still didn't fix anything.

Navigation

[0] Message Index

[#] Next page

Go to full version