FPM Preprocessor doesn't work

I need to use preprocessor directives in a program that I’m working. I must select between PIO lib and SMIOL lib for IO writes. I put a #ifdef - #endif inside my code to choose one of them. But the fpm build don’t recognize the directive -DPIO that i am using. Then I did a simple code, based on fpm example. I put the #ifdef to test the code. The main code are:

program main
  use teste_fpm, only: say_hello
  implicit none

  print *, 'testando o ofdef...'
#ifdef HELLO
  call say_hello()
#ifdef BANANA
  print *,'banana'

end program main

and the rest of code are the same of fpm example. To compile I used:

fpm build

without the flag “-DHELLO”, and the program pass inside the ifdef.

How can I do to use DEFINE (preprocessing) directives?

Hi all. I fix it!!! The problem was the program extension. The FPM don’t recognize “.F” to preprocessing. The code must use “.F90”.

1 Like