can't make fortran executable

Startbeitrag von armen am 04.04.2005 10:56

when compiling g77 -o test.f test, I am getting an undefined reference to MAIN__ error, does anyone know what this is from? I am only using fortran without c/c++.



first the correct command for g77 is:

g77 -o test test.f -> for Unix-like systems
g77 -o test.exe test.f -> for Windows

If you use japi routines you have to add:

g77 test.f -o test -ljapi -> for Unix
g77 test.f -o test -ljapi -lwsock32 -> for Windows

If you use Windows (what I guess) and you have only the g77 (MinGW) package installed the wsock32 library is not included. You have to look for 'libwsock32.a' and copy the library to your lib-directory. I don't know whether libwsock32.a is available separately or not. If not you can download the whole MinGW package 'MinGW-3.1.0-1.exe' from and use it instead of your g77-distribution. MinGW contains all necessary libs and files for FORTRAN, C, C++ etc. The g77 distribution contains really necessary files for fortran only.

I hope this helps. If I am wrong and you are not a Windows/MinGW-g77 user please let me know.

Best reagards,


PS: Read the documentation on carefully. 'MSYS-1.0.10.exe' is not really necessary except you want to use 'make'.

von Hani - am 06.04.2005 13:30
copy and paste error:

the correct command has to be:

g77 test.f -o test.exe -ljapi -lwsock32 -> for Windows
g77 -o test.exe test.f -ljapi -lwsock32

von Hani - am 06.04.2005 13:35
great. thank you

von armen - am 07.04.2005 07:21
Zur Information: hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.