Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Bad # preprocessor line

esatel
Beginner
1,722 Views
Hi, I have a macro in an include ".inc" file in a file with extension *.F90.

#define MYASSERT(expr) call assert_impl(expr)

This is part of building some MPI-friendly assert code and I want to use a macro because this will eventuallypasss in__FILE__ and __LINE__. The #define is in the leftmost column

My problem is that, compiling with "-fpp" I get the error "Bad # preprocessor line" with a carat below pointing to the "d" in define. I have tried other variants like "-fpp:-free" or "-fpp:free" but the compiler does not correctly understand the flags (it gives me a message about "-fp" not being recognized.

Is there something more I can do? Am I getting the flags wrong?

Thanks,
Eli
0 Kudos
3 Replies
jimdempseyatthecove
Honored Contributor III
1,722 Views
Eli,

Sometimes a typographical error or omission yields unexpected results.

Try this:

Create a new project.
In that project create an .inc file containing only that one #define listed above.
Create a PROGRAM (main) that includes the new .inc file.
Compile with -fpp.

If the error persists, then you have some probelm with the installed program (IVF and/or FPP)

If the problem goes away, then you likely have a problem with your current .inc file.
Likely unmatched #if...#endif

Jim Dempsey

0 Kudos
Steven_L_Intel1
Employee
1,722 Views
Jim, this is the Linux/Mac forum, so IVF and projects aren't relevant.

I tried compiling this line on its own but got no error. Can you show us a small but complete source that demonstrates the problem?
0 Kudos
esatel
Beginner
1,722 Views

Hey, guys ... thanks for the answers. I saw the problem merely by prepping the tests you guys suggested. It was an include issue. I had accidentally used Fortran include syntax (include "x") instead of preprocessor (#include "x").

0 Kudos
Reply