0

I need to use a conditional compilation in Fortran2008. So far I've found this solution, but it somehow doesn't work for me and despite compiling my code with -cpp flag like this

gfortran  -Dconnection_m_EXPORTS -I/home/martin/4Neuro/build/lib  -O2 -std=f2008 -cpp -fPIC   -c /home/martin/4Neuro/src/connection_m.f90 -o CMakeFiles/connection_m.dir/connection_m.f90.o

I'm still getting this error

/home/martin/4Neuro/src/connection_m.f90:133:13:
             #ifdef TIME_PROFILING
             1
Error: Invalid character in name at (1)
/home/martin/4Neuro/src/connection_m.f90:136:13:

             #endif
             1
Error: Invalid character in name at (1)
/home/martin/4Neuro/src/connection_m.f90:143:13:

             #ifdef TIME_PROFILING
             1
Error: Invalid character in name at (1)
/home/martin/4Neuro/src/connection_m.f90:148:13:

             #endif
             1
Error: Invalid character in name at (1)

Do you know, what am I doing wrong?

My gfortran version is: GNU Fortran (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005 And my files have the extension .f90.

Eenoku
  • 2,741
  • 4
  • 32
  • 64

1 Answers1

1

Preprocessor directives with # must have # appear in column 1.

Ross
  • 2,130
  • 14
  • 25