杰克·吉伦哈尔的博客 生活 学习

Fortran编译包含ifdef时报错

2019-07-30


编译fortran,含#ifdef时,报错,提示bad # preprocessor line

原因:

The message

warning #5117: Bad # preprocessor line

is potentially a little misleading. It suggests that the code has been passed through the preprocessor and it’s the preprocessor that’s unhappy. That isn’t always the case: ifort also produces this warning message when preprocessor directives occur in the source file but the preprocessor isn’t invoked.

To ensure that the preprocessor is run you have a couple of options:

  • add the flag -fpp (or -cpp) to the compilation command;
  • name the free-form source file with the suffix .F90 (note the capital).

Similar Posts

上一篇 新疆之旅

Comments