This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc -lm and libm.a for Mac OS X



On Nov 11, 2003, at 8:31 AM, Vincent Lemaitre wrote:


Hi,

When running the following command:
gcc -lm test_isnan.cc

I got the following error message:

ld: Undefined symbols:
___gxx_personality_v0

This symbol is needed for exception handling in c++, either compile with g++ or use -fno-exceptions or use higher optimizations.




The libm.a is missing in /usr/lib. And I suspect this is (part of) the reason of the reason for the error.

libm.a does not exists because it is part of the libSystem.dyld and Apple does not provide static libraries.




Could somebody explain me where and how to get libm.a under Mac OSX? Or is there another way to link the math library?


You do not have to explicitly link with the math library on Mac OS X (aka Darwin) to use it, it is already included in libSystem.


The gcc man page on Apple web site takes it for granted that libm.a should be in /usr/local, but it is not. The only library that could be a math library is libm.dylib@...
(I have installed the Apple's Developper's Tools and all the C libraries I could find with fink, without success).


Thank you in advance,

Vincent

test_isnan.cc:

#include <stdio.h>
#include <math.h>

int main()
{

printf("Hello it's test program for isnan()\n");

printf(" \"3000\" is a NUMBER?\t: %d\n",isnan(3000.0));

  return 1;
}





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]