Preprocessor Macro not working on Windows in Fortran Code

后端 未结 1 1804
面向向阳花
面向向阳花 2020-12-22 01:13

Dear All I have a small Fortran program containing preprocessor macro. Below is a minimal example. On mac os x, it works well but when I compile it on windows 7 (64-bit) it

相关标签:
1条回答
  • 2020-12-22 01:43

    This might be GFortran PR 42954. Since GFortran started using libcpp instead of running cpp in a separate process, many of these built-in macros are missing.

    As a workaround, you can as part of your build process generate a file with these builtin macro definitions which you can then include. E.g. have a make target which runs

    gcc -E -dM - < /dev/null > builtins.inc
    

    Then your sources should depend on builtins.inc in the Makefile, and in the beginning of your source files you

    #include "builtins.inc"
    
    0 讨论(0)
提交回复
热议问题