I get the following errors when trying to create a small and simple project that includes <cmath> in Xcode:
cmath: '*' has not been declared
'::acos' has not been declared
In file included from /Xcode4/Projects/libraryLAFMath/Classes/libraryLAFMath.cp
In file included from /Xcode4/Projects/libraryLAFMath/Classes/libraryLAFMath.h
'::acos' has not been declared in /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/usr/include/c++/4.2.1/cmath
...
The error log also complains about all other mathematical functions, sin , pow , etc., and not just acos . I looked into the cmath source code and references the globally defined corresponding math functions from math.h , i.e. ::acos etc. Since the root error complains about the non-existence of ::acos , it can be assumed that math.h can't be found, but a) it exists, and b) I would get another error complaining that math.h could not be found.
The source code is as follows:
libraryLAFMath.cp:
#include "libraryLAFMath.h"
libraryLAFMath.h:
#include <cmath> struct libraryLAFMath { void test() { double a = std::acos(0); } };
Now I have another project from an external source that uses cmath and compiles fine. I tried to compare build settings between the two projects, but they are almost the same. I use the LLVM GCC 4.2 compiler, but I get a similar result when using GCC 4.2, so I do not think this is a problem with the compiler options.
I am new to Xcode development and any help is appreciated.
c ++ xcode cmath
andrewz
source share