views:

991

answers:

1

I'm getting the following error in Xcode 3.2.1 on Snow Leopard 10.6.2 whenever I try to compile any iPhone application generated by Appcelerator's Titanium . However , the build error only appears when I select iPhone simulator on the architecture menu , and if I select iPhone device , I am able to run the app on my device .

Further , the iPhone simulator launches successfully and executes the program directly from the Titanium environment , which uses Xcode to build .

Why is this happening ?

ld: duplicate symbol _main in Resources/libTitanium.a(main.o) and /Users/prithviraj/Documents/project/Final/build/iphone/build/Final.build/Debug-iphonesimulator/Final.build/Objects-normal/i386/main.o collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

A: 

I can't tell you why this is happening, but I can suggest a workaround. When I commented out the entire contents of the main.m file that was generated for my Titanium project, I was able to compile successfully and run on the Simulator. Let me know if that works for you.

warrenm
As a clarification, the reason why you see the error is that libTitanium, the primary Titanium library file, contains a `main` entry point and this is therefore redundant to the `main` function in main.m. I'm not sure why this problem doesn't crop up elsewhere, but it must be something with the way the compiler is invoked by Titanium, to hook into their entry point instead of the one in main.m.
warrenm
Thanks warren , It works :)
Prithvi Raj