User forums > Using Code::Blocks

Associate compiler to file extension

(1/1)

some_teacher:
Hello all,

I am currently teaching an introductory course on numerical methods using Fortran (department policy). We give the students an archaic IDE (Force) which honestly I don't like. In the previous semester they learned C++ using Code::Blocks. Since it can do C/C++ and Fortran at the same time, I plan on telling them to just keep using Code::Blocks, helping them to properly configure it.

The thing is, while I was testing Code::Blocks I have encountered an issue: when I hit F9 to compile+run, I  usually get the 'undefined reference to _gfortran_st_write' error. This happens because it is trying to compile a Fortran source code (saved with .f extension) using gcc instead of gfortran. I can solve this by selecting gfortran as a default compiler, but then I have the opposite problem with C/C++ source files.

Is it possible to configure Code::Blocks so that it chooses the compiler according to the source file extension, or to solve this issue in any other way? The idea is not to have to manually switch the compiler every time.

Thanks a lot!

gd_on:
Create a project. That's easy. I think you don't do that. In each project you define which compiler to use, which specific options to use...

some_teacher:
Aha, I tried and it does work. I usually compile manually or through makefiles myself, so I am quite rusty regarding IDEs. Thanks!

Navigation

[0] Message Index

Go to full version