C Library Problem: M_E Constant Issues

  • Thread starter Thread starter Peter P.
  • Start date Start date
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
Peter P.
Messages
23
Reaction score
0
I was working on an assignment and i needed to use a constant that is defined in the math.h library (M_E). But when i tried to use it, the compiler took it as a normal variable that had not been initialized or anything. So my question is, is this just because of the compiler i was using, or is there something wrong with the library on my laptop?
 
Physics news on Phys.org
According to this wiki article (http://en.wikipedia.org/wiki/Math.h), the M_* constants aren't standard. It also says,
While these constants are common, they are not part of the C standard, so most modern compilers require an explicit definition (such as _USE_MATH_DEFINES in Microsoft Visual C++ [1]) for them to be defined when including math.h.
 
Thanks for the answer, that cleared it up for me.