Author Topic: forcing code blocks to compile with g++  (Read 7606 times)

jarro_2783

  • Guest
forcing code blocks to compile with g++
« on: April 20, 2006, 10:21:52 am »
I have got a c++ program that uses a c file. One of my c++ functions calls a function from this c file. Codeblocks compiles this c file with gcc and everything else with g++. This makes the .o files incompatible with each other and I get undefined reference to function when it links it.
Is there any way to force code blocks to always g++ for this particular project?

I could just compile the file separately and then it would never need to recompile it ever again, but it could still be good to know.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: forcing code blocks to compile with g++
« Reply #1 on: April 20, 2006, 10:25:41 am »
rename the file.c to file.cpp -> then g++ will compile it

jarro_2783

  • Guest
Re: forcing code blocks to compile with g++
« Reply #2 on: April 20, 2006, 10:32:19 am »
ok, thanks, so that won't break anything?

jarro_2783

  • Guest
Re: forcing code blocks to compile with g++
« Reply #3 on: April 20, 2006, 10:34:37 am »
I just found out something, if you right click on the file and press properties then go to advanced, there is a box that says compiler variable. If you change that to CPP it compiles it with g++.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: forcing code blocks to compile with g++
« Reply #4 on: April 20, 2006, 10:38:13 am »
I just found out something, if you right click on the file and press properties then go to advanced, there is a box that says compiler variable. If you change that to CPP it compiles it with g++.

:-)