Author Topic: Problems with fortran compiler  (Read 9318 times)

Offline Rfernandez

  • Single posting newcomer
  • *
  • Posts: 4
Problems with fortran compiler
« 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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Problems with fortran compiler
« Reply #1 on: January 27, 2016, 08:30:37 pm »
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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Rfernandez

  • Single posting newcomer
  • *
  • Posts: 4
Re: Problems with fortran compiler
« Reply #2 on: January 29, 2016, 11:54:44 pm »
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.


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problems with fortran compiler
« Reply #3 on: January 30, 2016, 06:57:16 am »
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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Rfernandez

  • Single posting newcomer
  • *
  • Posts: 4
Re: Problems with fortran compiler
« Reply #4 on: January 31, 2016, 02:04:42 am »
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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problems with fortran compiler
« Reply #5 on: January 31, 2016, 02:09:27 am »
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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Rfernandez

  • Single posting newcomer
  • *
  • Posts: 4
Re: Problems with fortran compiler
« Reply #6 on: January 31, 2016, 03:56:05 am »
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

Offline standegroff

  • Single posting newcomer
  • *
  • Posts: 2
Re: Problems with fortran compiler
« Reply #7 on: April 03, 2018, 05:34:01 pm »
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.

Offline BentL

  • Single posting newcomer
  • *
  • Posts: 8
Re: Problems with fortran compiler
« Reply #8 on: April 04, 2018, 08:51:02 am »
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 in order to work with files.

Offline standegroff

  • Single posting newcomer
  • *
  • Posts: 2
Re: Problems with fortran compiler
« Reply #9 on: April 04, 2018, 06:23:58 pm »
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.


Offline BentL

  • Single posting newcomer
  • *
  • Posts: 8
Re: Problems with fortran compiler
« Reply #10 on: April 05, 2018, 08:52:49 am »
Are you sure you have created a project?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Problems with fortran compiler
« Reply #11 on: April 05, 2018, 09:50:43 am »
 
Quote
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...)