Code::Blocks Forums
User forums => Help => Topic started by: Rfernandez on January 27, 2016, 05:36:36 pm
-
I am tryiinf to use the code blocks fortran compiler, but I can´t make it work; apparently code blocks doesn´t find the compiler. I enclose a simple program and the messages obtained in the build process. I have windows 7 professional. I modify the PATH to
C:\Program File (x86)\gfortran\bin;C:\cygwin\bin;C:\Program Files (x86)\CodeBlocks\MinGW\bin
I was using NetBeans but I want to try Code Blocks now.
Thanks for any suggestion!!!
Ricardo
-
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
Where is the FORTRAN compiler located?
Where did you tell Code::Blocks to look for it?
Post a Full re-build log; this does NOT mean a message log!!
Tim S.
-
I enclose the build log; the compiler is set within the bin directory of codeblocks:
Archivos de Programa(x86)/CodeBlocks/MinGW/bin
and the compiler settings are shown in the file attached.
-
and the compiler settings are shown in the file attached.
Well you are using the GNU GCC compiler and not the GNU G95 compiler as the build log clearly shows. Please adjust your project's build settings at project AND target level to use the right compiler.
Next time please read more carefully - this is really obvious.
-
Morten,
I know it is so obvious, but the compiler settings are set as G95 Fortran; despite this settigs, the building log presents GNU GCC compiler. I don't know what is wrong.
-
Yes, but you have to select the fortran compiler in the project settings.
In the log you can see that C::B is using the GCC compiler.
-
I didn´t know that I had to change the project settings, after changing the settings in code blocks main bar. Thanks for the tip!
I changed already the project settings and only an error appeared:
-------------- Build: Debug in pruebaFor (compiler: G95 Fortran Compiler)---------------
mingw32-gfortran.exe -fmod=obj\Debug\ -Wall -g -c "C:\Users\Ricardo Fernández\Desktop\2 INININ\Simulador\Prototipo\Programacion\pruebaFor\main.f95" -o obj\Debug\main.o
mingw32-gfortran.exe: error: unrecognized command line option '-fmod=obj\Debug\'
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
I don´t know how to correct this error, could you help please?
Thanks
Ricardo
-
I have the same problem. I don't know what I'm doing....
I used the self installing files, installed codeblocks ming 17.12 with gcc, then the one with gfortran. I have played with settings but it continues to want to use GCC compiler. Where are these settings ? I have tried using fortran on and off for the last couple years and have not gotten past this point.
The errors on the demo first program are "Undefined reference to '_gfortran_transfer_character_write'.
It obviously is stuck on GCC even when I set it to gcc fortran as default compiler. gfortran.exe is in the "C:\Program Files (x86)\CodeBlocks\MinGW\bin" directory which I believe is correct.
-
You need to configure your Fortran project properly. The best way to start a new Fortran project is to use the "Fortran application" template:
File > New > Project... > Projects > Fortran application > Go
This way all necessary settings needed for a Fortran project are applied.
But you can also manually set these settings.
1) First set the compiler:
File > Settings... > Compiler... > Global compiler settings > Selected compiler: GNU Fortran Compiler
Then the toolchain:
File > Settings... > Compiler... > Global compiler settings > Toolchain executables > Program files
with the settings:
C compiler: mingw32-gfortran.exe
C++ compiler: mingw32-gfortran.exe
Linker for dynamic libs: mingw32-gfortran.exe
Linker for static libs: ar.exe
Debugger: GDB/CDB debugger : default
Resource compiler: windres.exe
Make program: mingw32-make.exe
2) Next you can configure the debugger:
Settings > Debugger... > GDB/CDB debugger > Default > Executable path > C:\Program Files (x86)\CodeBlocks\MinGW\bin\gdb32.exe
and select GDB as debugger.
3) Next you can specify that all libraries should be statically linked to the exe-file, so the application contains just one file:
File > Project > Build options... > Select application name > Linker settings > Other linker options > -static
4) Finally, you need to update the file "libgfortran-3.dll" as described in this post (http://forums.codeblocks.org/index.php/topic,22354.msg152932.html#msg152932) in order to work with files.
-
Thanks, I appreciate the details. I will try it.
Interesting though ...
I have another Win 7 machine 32 bit (company owned and secured) It is running 13.12 and will compile C++ source.
The one I'm having problems with is a 64 bit Win 10 running 17.xx codeblocks. It will not compile C++ either !!! It is secured and owned by the company.
I think I have some security issues.
Another thing, The older machine shows codeblocks in the "Programs and Features" screen. The Win 10 machine does not show it. and I can't uninstall. "Programfiles(x86)\codeblocks" can't delete.
-
Are you sure you have created a project?
-
It will not compile C++ either !!!
Without detailed error description we can not help you... Simply "does not work", "does not compile", "gives error" ecc. do not help in finding a solution... ALWAYS give full error messages, exact description of behaviour and expected behaviour... (this is not limited to this forum. This rules apply to ALL forums out there...)