Go Down

Topic: accessing math functions in .cpp file, arduino 18 (Read 2237 times) previous topic - next topic

lucasvickers

Hello,

I include a file "stats.h" from my main pde.
in stats.cpp, I wish to use the sqrt function.

If I include "math.h", I get the following errors.

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/include/math.h:439: error: expected unqualified-id before 'double'

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/include/math.h:439: error: expected `)' before 'double'

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/include/math.h:439: error: expected `)' before 'double'

these happen with or without actually trying to call the sqrt function.

any help would be great.

thanks,
Lucas

PaulS

Quote
If I include "math.h", I get the following errors


Where are you including math.h? In stats.h? In stats.cpp? In the .pde file?
The art of getting good answers lies in asking good questions.

lucasvickers

Hello,

pde includes stats.h
stats.cpp includes stats.h and math.h

I wish to gain access to the routine in stats.cpp

Coding Badly

Does the PDE, stats.h, or stats.cpp contain anything named "round".  A #define perhaps?  Or a variable named "round"?  Or a function named "round"?

PaulS

#4
Feb 09, 2010, 11:49 am Last Edit: Feb 09, 2010, 11:50 am by PaulS Reason: 1
Try include the math.h file in the sketch (the .pde file), too.
The art of getting good answers lies in asking good questions.

lucasvickers

nothing named round

including "math.h" in the pde worked!  thank you.

Go Up