osx - C++ math.h on OS X 10.8.5 -
i have c++ program not compile under os x 10.8.5 g++ compiler. problem seems math.h header file.
this version of g++
g++ -v using built-in specs. collect_gcc=g++ collect_lto_wrapper=/users/densmore3/local/usr/local/bin/../libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper target: x86_64-apple-darwin14.0.0 configured with: ../gcc-4.9-20141029/configure --enable- languages=c++,fortran thread model: posix gcc version 4.9.2 20141029 (prerelease) (gcc)
there 40-50 errors of type below. code compiled fine on 10.6. going on?
/users/xxxx/local/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include-fixed/math.h:203:1: error: ‘__header_always_inline’ not name type __header_always_inline int __inline_isfinitef(float); users/densmore3/local/usr/local/lib/gcc/x86_64-apple-darwin14.0.0/4.9.2/include-fixed/math.h:580:27: error: expected initializer before ‘__availability_internal__mac_10_0_dep__mac_10_9’ extern float __inff(void) __osx_available_but_deprecated(__mac_10_0, __mac_10_9, __iphone_na, __iphone_na);
here piece of test code gives same error real code. error goes away if remove math.h include statement.
#include <iostream> #include <math.h> #include <stdio.h> //#include <complex> //#include <vector> int main(int argc, const char * argv[]) { // insert code here... std::cout << "hello, world!\n"; return 0; }
the compile command using is:
g++ test.cpp
gcc-4.8
correct version use on os x 10.8.
Comments
Post a Comment