Author Topic: Correct settings for using g95 Fortran compiler?  (Read 14730 times)

Offline mconsidine

  • Multiple posting newcomer
  • *
  • Posts: 10
Correct settings for using g95 Fortran compiler?
« on: December 21, 2008, 10:48:22 pm »
Hi,
I think this is the right board for this question!  In any case, I'm able to compile a three line "Hello world" program using the GNU Fortran compiler.  But if I set up the g95 compiler (under Windows, MinGW) and run the same program, I'm getting a linker error associated with libf95.a.  Specifically,

Linking console executable: bin\Release\test2.exe
..\..\..\MinGW\lib\gcc-lib\i686-pc-mingw32\4.0.4\libf95.a(main.o):(.text+0x32): undefined reference to `MAIN_'
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings

where "test2" consists of these three lines :
10 PROGRAM hello
20 PRINT*,'Hello world'
30 END PROGRAM hello

So I'm thinking I don't have some flag/define/option/etc. that's specific to g95 set.

My question is : does anyone use g95 under CodeBlocks and if so could you share your compiler settings and defaults?

Thanks in advance.  And apologies if this is the wrong board for this question.  (I searched for "g95" but perversely got no hits.  Even though I've seen the word in the text of messages ...)

Matt

Offline mconsidine

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Correct settings for using g95 Fortran compiler?
« Reply #1 on: December 22, 2008, 07:07:35 pm »
Answering my own question :

I finally got the G95 compiler to work by adding this to the linker options :
  -lfrtbegin
This was placed first in the list (for what it's worth), ahead of the two that came from copying
the G77 compiler settings as outlined in another thread here.

Matt

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Correct settings for using g95 Fortran compiler?
« Reply #2 on: December 22, 2008, 07:57:51 pm »
feel free to add some notes to this wiki entry:

http://wiki.codeblocks.org/index.php?title=Installing_Fortran_Compiler

linqyxy

  • Guest
Re: Correct settings for using g95 Fortran compiler?
« Reply #3 on: April 13, 2009, 06:19:06 pm »
can anyone post a pic already work.

vd63

  • Guest
Re: Correct settings for using g95 Fortran compiler?
« Reply #4 on: November 01, 2009, 10:29:58 am »
For me, it don't works.

I have the following message

ld: crt2.o: pas de fichier tel: No such file or directory

I'll try to add manually crt2.o in the link librairies section without succeed.

Thank you for any idea ...

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7590
    • My Best Post
Re: Correct settings for using g95 Fortran compiler?
« Reply #5 on: November 01, 2009, 06:13:48 pm »
For me, it don't works.

I have the following message

ld: crt2.o: pas de fichier tel: No such file or directory

I'll try to add manually crt2.o in the link librairies section without succeed.

Thank you for any idea ...

Under C/C++ the cause is normally missing the Compiler/Debugger settings for Linker search directory containing  "crt2.o" file.

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

vd63

  • Guest
Re: Correct settings for using g95 Fortran compiler?
« Reply #6 on: November 01, 2009, 07:25:24 pm »

I think about it and I try to add path c:\MinGW\lib in the search directories linker section, but without success. I try to manually add crt2.o to the project too, but no effect ...

Jenny

  • Guest
Re: Correct settings for using g95 Fortran compiler?
« Reply #7 on: February 20, 2010, 02:00:58 am »
Hello, I just installed Fortran 95 Compiler for Windows (mingw), but I have no idea, how to open the environment, or where to write the quelltext. Can somebody help me?