Re: Where is sqrtf?
Re: Where is sqrtf?
- Subject: Re: Where is sqrtf?
- From: Mike Lazear <email@hidden>
- Date: Sat, 8 Jan 2005 19:35:31 -0800
On Jan 8, 2005, at 7:18 PM, Robert Purves wrote:
At the command line, gcc has no problem with this tiny program:
/* test.c */
#include <math.h>
#include <stdio.h>
int main( void )
{
float x = sqrtf( 2.0f );
printf( "%f\n", x );
return 0;
}
% gcc -lmx -o test test.c
%
Note: -lmx is required for C99 float functions such as sqrtf, in math.h
When I try the same in Xcode (with -lmx specified in Other C Flags), I get an error:
gcc-3.3: -lmx: linker input file unused because linking not done
ld: Undefined symbols: _sqrtf
How can I persuade Xcode that sqrtf exists?
In XCode I selected a new project of type "Carbon Application". I replaced the standard main() with yours and it compiled, linked and ran fine.
Here's my current main.c file:
//
// main.c
// junk
//
// Created by Mike Lazear on 1/8/05.
// Copyright __MyCompanyName__ 2005. All rights reserved.
//
#include <Carbon/Carbon.h>
int main(int argc, char* argv[])
{
float x = sqrtf( 2.0f );
printf( "%f\n", x );
return 0;
}
Hope that helps,
Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden