Opened 13 years ago

Last modified 13 years ago

#1521 closed defect (fixed)

Compilation failed: ‘NAN’ undeclared

Reported by: rlangella Owned by: rlangella
Priority: high Milestone:
Component: Version:
Keywords: Cc: rlangella,

Description

When compiling, I get this error:

gcc44 -O3 -march=native -fPIC -I/Produits/publics/x86_64.Linux.RH5/rml-mmc/2.3.8/include/plain -I../../c_runtime -I../ -I. -Ilpsolve -c -o SimulationResults_rml.o SimulationResults_rml.c
In file included from SimulationResults_rml.c:36:
SimulationResults.c: In function ‘SimulationResultsImplval’:
SimulationResults.c:99: error: ‘NAN’ undeclared (first use in this function)
SimulationResults.c:99: error: (Each undeclared identifier is reported only once
SimulationResults.c:99: error: for each function it appears in.)
make[4]: * [SimulationResults_rml.o] Error 1

The file SimulationResults_rml.c does include omc_msvc.h which defines NAN, so I don't understand. Copying the NAN definition inside the SimulationResults_rml.c fixed it for me.

Change History (2)

comment:1 Changed 13 years ago by sjoelund.se

That header is only used because Windows does not include these headers.

Any C99 system should have them available; does RedHat not support this? If you change your CC to gcc44 -std=c99, does it work?

NAME
       INFINITY,  NAN,  HUGE_VAL,  HUGE_VALF,  HUGE_VALL - floating-point con?
       stants

SYNOPSIS
       #define _ISOC99_SOURCE
       #include <math.h>

comment:2 Changed 13 years ago by sjoelund.se

r8969 now uses the Visual studio INF/NAN hack if they were not defined by math.h

Note: See TracTickets for help on using tickets.