PDA

View Full Version : math.h include error



Rayven
12th July 2006, 17:15
I am compiling an application using gcc/g++ 3.4. When I #include <math.h> and try to compile, I get the following error:

client# g++ -o -pipe -g -D_REENTRANT -Wall -I../include -I/usr/local/Trolltech/Qt-4.1.4/include/QtCore -I/usr/X11R6/include Data.o ../src/Data.cpp

In file from /usr/include/math.h:93
from ../src/Data.cpp:36
/usr/include/bits/mathcalls.h:154:error: expected unqualified-id before 'float'
/usr/include/bits/mathcalls.h:154:error: expected ')' before front

I am not getting to the link step, but -lm is in the linker step. Is there something wrong with my makefile? :confused:

jpn
12th July 2006, 17:35
Try


#include <cmath>

or


extern "C" {
#include <math.h>
}

Rayven
13th July 2006, 19:54
That worked, Thanks!:D