I am trying to compile some Fortran code. The compiling options I used are:
FFLAGS= -c -byteswapio -DLinux -O
LDFLAGS = -lg2c
LINKFLAGS = -lg2c
In the Fortran code, there are some places call iargc() and getarg(). But the program seems couldn’t read the arguments from the command line such as:
*.exe input.file1 input.file2
When I tried to print out the value of iargc(), it gave me –1.
Then I tried to write some Fortran code very simple which also calls those functions. And it worked fine until I added -lg2c when compiling. So I guess it’s –lg2c gave me trouble, and I tried to delete -lg2c in my Makefile. However it ended up with giving me lots of undefined reference error to some Gempak library which was compiled by gcc and g77.
Any suggestions on how to fix it?