preprocessor warning!

preprocessor warning!

I want to check if there is some parameter has already been defined,so I worked like this :
#ifdef NO64BITS
INTEGER, PARAMETER, public :: i8b = i4b
#else
INTEGER, PARAMETER, public :: i8b = SELECTED_INT_KIND(16)
#endif
But when I compile it ,the compliler shows :"warning, bad # preprocessor line" .I'm a newer to fortran,so I don't know what and how to do with it.Any answer is appreciated!
Have a nice day!

11 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

As this stuff isn't entirely standard, each compiler has a different way of enabling it. If you are using ifort, perhaps you intended to set /Qfpp (or enable pre-processing in Visual Studio), but forgot to do so or to tell us about it.

You can try:

#if defined (NO64BITS)

...

Quoting - John

You can try:

#if defined (NO64BITS)

...

It still act wrong as before after I done as your suggestion.........

Quoting - ppthelion

It still act wrong as before after I done as your suggestion.........

Make sure that the "#" symbol is in the first column, and that you are indeed invoking the preprocessor (with the /fpp command-line option)

Quoting - tim18
As this stuff isn't entirely standard, each compiler has a different way of enabling it. If you are using ifort, perhaps you intended to set /Qfpp (or enable pre-processing in Visual Studio), but forgot to do so or to tell us about it.

I have changed the 'preprocess source file ' --> (Yes/fpp),but it shows the same error.What I use is visual studio 2008+ intel fortran 11.1.051; I think it may be act as mkl_fftw_ms, so I try to connect with mkl_solver.lib mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib,but it doesn't worktoo.....I have no idea to do anything with it now ,help me!

Quoting - tim18
As this stuff isn't entirely standard, each compiler has a different way of enabling it. If you are using ifort, perhaps you intended to set /Qfpp (or enable pre-processing in Visual Studio), but forgot to do so or to tell us about it.

Sorry,it's my fault..... according to my command ,I has lost a flag 'Q' --/fpp not work ,/Qfpp work well !! But I found another intresting phenomena. In visual studio 2008+intel fortran 11.051,I want to change the preprocess like this : properties--> Fortran-->preprocessor-->preprocess source file,only /fpp options canbe chosen,and if you want to add /Qfpp,then command Line can do this!
Thanks!

In addition ,the document as follow may help people meet the same problem as me .it introduce the diff between /fpp and /Qfpp ,also the usage:

Runs the Fortran preprocessor on source files before compilation.

IDE Equivalent

Windows: Preprocessor > Preprocess Source File

Linux: None

Mac OS X: Preprocessor > Preprocess Source File

Architectures

IA-32, Intel 64, IA-64 architectures

Syntax

Linux and Mac OS X:

fpp[n]

fpp[="option"]

-nofpp

Windows:

/fpp[n]

/fpp[:"option"]

/nofpp

/Qfpp[n]

/Qfpp[:"option"]

Arguments

n

Deprecated. Tells the compiler whether to run the preprocessor or not. Possible values are:

0

Tells the compiler not to run the preprocessor.

1, 2, or 3

Tells the compiler to run the preprocessor.

option

Is a Fortran preprocessor (fpp) option; for example, "-macro=no", which disables macro expansion. The quotes are required. For a list of fpp options, see Fortran Preprocessor Options.

Default

nofpp

The Fortran preprocessor is not run on files before compilation.

Description

This option runs the Fortran preprocessor on source files before they are compiled.

If the option is specified with no argument, the compiler runs the preprocessor.

If 0 is specified for n, it is equivalent to nofpp.Note that argument n is deprecated.

We recommend you use option Qoption,fpp,"option" to pass fpp options to the Fortran preprocessor.

Alternate Options

Linux and Mac OS X: -cpp

Windows: /Qcpp

Quoting - ppthelion

Sorry,it's my fault..... according to my command ,I has lost a flag 'Q' --/fpp not work ,/Qfpp work well !! But I found another intresting phenomena. In visual studio 2008+intel fortran 11.051,I want to change the preprocess like this : properties--> Fortran-->preprocessor-->preprocess source file,only /fpp options canbe chosen,and if you want to add /Qfpp,then command Line can do this!
Thanks!

I'm glad you're working, but I'm puzzled by what you've said here.

/fpp is equivalent to /Qfpp, and in fact we will be deprecating (slowly getting rid of) /Qfpp in a future release.

The documentation does list optional numbers after the "fpp" part, but those are ignored (and were there for compatibility with the V7.1 Fortran compiler).

Anyway, would you mind posting the build log from your case that was failing simply by setting Fortran-->preprocessor-->preprocess source file ? I'm curious about it .

thanks --

- Lorri

Quoting - Lorri Menard (Intel)

I'm glad you're working, but I'm puzzled by what you've said here.

/fpp is equivalent to /Qfpp, and in fact we will be deprecating (slowly getting rid of) /Qfpp in a future release.

The documentation does list optional numbers after the "fpp" part, but those are ignored (and were there for compatibility with the V7.1 Fortran compiler).

Anyway, would you mind posting the build log from your case that was failing simply by setting Fortran-->preprocessor-->preprocess source file ? I'm curious about it .

thanks --

- Lorri

I'm sorry for answering you so late,here is the compile log:
Compiling with Intel Visual Fortran 11.1.051 [IA-32]...
ifort /nologo /debug:full /Od /Qfpp /gen-interfaces /warn:interfaces /module:"Debug" /object:"Debug" /traceback /check:bounds /libs:static /threads /dbglibs /c /extfpp:cfortran.h,cfitsio.h /fpp /libs:dll cfitsio.lib /MD /iface:cvf /Qvc9 /Qlocation,link,"C:Program Files (x86)Microsoft Visual Studio 9.0VCbin" "E:lib_newHealpix_2.13asrcf90modhealpix_types.F90"
E:lib_newHealpix_2.13asrcf90modhealpix_types.F90(45): #error: '#ifdef' argument starts with wrong symbol.

Console1 : error PRJ0019: A tool returned an error code
and the original code is:
#ifdef (NO64BITS)
INTEGER, PARAMETER, public :: i8b = i4b
#else
INTEGER, PARAMETER, public :: i8b = SELECTED_INT_KIND(16)
#endif
Thanks for your attention!

Quoting - ppthelion

#ifdef (NO64BITS)

Remove the parentheses around the #ifdef argument, ie:

#ifdef NO64BITS

Leave a Comment

Please sign in to add a comment. Not a member? Join today