MAIN, has not been explicitly declared

I am having a strange issue with pgfortran, 18.4-0 64-bit on x86-64 Linux. When trying to compile a fortran 90 code, I get the following error message:

pgfortran -O  -acc -Minfo=accel spectrum.f90 -o spectrum
PGF90-S-0038-Symbol, MAIN, has not been explicitly declared (spectrum.f90)
  0 inform,   0 warnings,   1 severes, 0 fatal for fct
Makefile:21: recipe for target 'spectrum' failed
make: *** [spectrum] Error 2

Any idea of what is going on?

More info about the code: this is a astrophysical code with 1700 lines, which I am porting from openmp to openacc (GPU). It contains a couple of parallel loops which call subroutines.

Hi nemmen,

This is a link error meaning that the source doesn’t contain a main program.

Is the main program in a different source? If so, then you’ll want to add the “-c” flag to tell the compiler to stop after compilation and not link.

Hope this helps,

Thanks for the help, Mat. I found out that the origin of the error is because I did not include the CONTAINS statement to include the subroutines in the source file. After I’ve done that, the code proceeds compilation.