Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -m64 on Intel works with gcc but not Xcode




Syd Polk wrote:

You should add an architecture from the Build Configuration or Target build properties pane. This will make Xcode pass all of the right flags automagically.

On Apr 29, 2007, at 5:42 AM, Robert Purves wrote:

From the command line, gcc on my Intel Mac allows -m64 and produces working 64 bit executables:
$ cat test.c
#include <stdio.h>
int main( void )
{
printf( "Hello, World!\n" );
return 0;
}


$ gcc test.c -o test -m64 && ./test
Hello, World!
$ file test
test: Mach-O 64-bit executable x86_64

On attempting to build the same file as a Standard Tool in Xcode 2.4.1, compilation is OK but if -m64 is supplied as OTHER_CFLAGS, there's a link error:
/usr/bin/ld: Undefined symbols:
_main
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../crt1.o reference to undefined _main


Xcode seems less capable than gcc itself. Is there a workaround?

Yes, architecture (ARCHS = x86_64) is the solution. -m64 is mickey mouse.
This being my first venture in 64-bit computing, I tried:
printf( "sizeof {i, l, p} = {%d, %d, %d}\n", sizeof( int ), sizeof ( long ), sizeof( void* ) );
with the result as expected for LP64:
sizeof {i, l, p} = {4, 8, 8}


Robert P.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >-m64 on Intel works with gcc but not Xcode (From: Robert Purves <email@hidden>)
 >Re: -m64 on Intel works with gcc but not Xcode (From: Syd Polk <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.