Hello all,
I tried to use fortran with gcc and Suse 10.3… The code of the first program is:
PROGRAM MAIN
INTEGER N, X
EXTERNAL SUB1
COMMON /GLOBALS/ N
X = 0
PRINT *, 'Enter number of repeats'
READ (*,*) N
CALL SUB1(X,SUB1)
END
SUBROUTINE SUB1(X,DUMSUB)
INTEGER N, X
EXTERNAL DUMSUB
COMMON /GLOBALS/ N
IF(X .LT. N)THEN
X = X + 1
PRINT *, 'x = ', X
CALL DUMSUB(X,DUMSUB)
END IF
END
To compile the program, I put the following commands in the terminal window:
conrad@linux-jgw6:~/Fortran/First> gcc -Wall -c firsttry.f
conrad@linux-jgw6:~/Fortran/First> gcc firsttry.o -lgfortran
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/…/…/…/…/lib64/crt1.o: In function _start': (.text+0x20): undefined reference to
main’
collect2: ld returned 1 exit status
Possibly there is something wrong with the part ‘main’. I thing it doesn’t depend on the code above, because other codes produce the same error message.
Do you have any suggestions to solve this problem.
Thanks in advance.
Conrad