Re: #define in an "include file"



sarvin.moghaddam@xxxxxxxxx wrote:
Dear All,

I am trying to compile my code using "Compaq Visual Fortran" which
includes some *.for and some *.inc files. In one of the *.inc files
(define.inc) I have:

# define INT2 integer*2
# define REAL real*8
# define EXP dexp
# define SQRT dsqrt
# define ZERO 0.0d0
# define HALF 0.5d0
# define ONE 1.0d0

And obviously I include the define.inc file in the main and all the
subroutine as:
#include "define.inc"

but for some ? reason when I compile the code using the "Rebuild All"
option under Build toolbar, I get warnings such as:

Warning: Variable ONE is used before its value has been defined
if (csp.gt. ONE) csp= ONE

As these are pre-processor defines, you must set the project up to invoke pre-processing (command line option /Qfpp). Among the most frequently given bits of advice on this list are better ways to do these. It might make more sense to declare those constants with PARAMETER.
.



Relevant Pages

  • RE: Redhat 9.0 development environment wierdness...
    ... It still has the warnings you posted. ... setup depends on you or the project you are trying to compile. ... Redhat 9.0 development environment wierdness... ... need to install on our servers and if I can't even get through these I ...
    (RedHat)
  • Re: does VS C++ 2005 actually work????
    ... may be the same size as a pointer, they have nothing logically to do with ... sizeofand size_t generating warnings when used in the context of API ... I can't compile ... justified criticism regarding the reliability of Windows. ...
    (microsoft.public.vc.mfc)
  • Re: 2.6.23.9-rt13
    ... If I compile -rt13 I get some compile warnings on ARM: ... Both warnings are fixed by the attached patch, but warning 2 needs some review. ... New changes by Steven Rostedt, Gregory Haskins, ... Revert lazy disable irq from simple irq handler ...
    (Linux-Kernel)
  • Re: Using unused variables
    ... I get loads of "unused variable" warnings during compile ... Compiler switches that disable reporting of unused variables are out of ... which may draw dead code diagnostics from aggressive optimizing compilers. ...
    (comp.lang.fortran)
  • Re: <ftream> errors under g++ 3.2.2
    ... > gives error messages about implicit typenames being deprecated, ... is nothing you can do to your code to prevent the warnings. ... From your output, I don't see compile failures, I see warnings. ... I am surprised that a GCC header would have an implicit ...
    (freebsd-current)