How to compile iphone code using makefile?

I want to compile an iPhone application using the make command. But he always shows an error

make: /opt/iphone/bin/arm-apple-darwin-gcc: No such file or directory make: *** [src/main.o] Error 1 

Here is the contents of the makefile.

 CC=/opt/iphone/bin/arm-apple-darwin-gcc \ -isysroot /opt/iphone/addons/1.0.2/system \ -isystem /opt/iphone/include \ -isystem /opt/iphone/include/gcc/darwin/3.3 \ -F/opt/iphone/addons/1.0.2/system/System/Library/Frameworks 

How to compile my application. I am not familiar with unix commands. So please guide me step by step.

Update

Now we get an error after changing the paths.

  from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:9, from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:9, from src/main.m:23: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h: At top level: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:15: error: syntax error before 'BOOL' /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:16: fatal error: method definition not in @implementation context compilation terminated. make: *** [src/main.o] Error 1 
+4
source share
1 answer

Replace / opt / iphone / with / Developer / Platforms / iPhoneOS.platform / Developer / usr / or where your gcc is located. If I looked into the bin subdirectory, there will be no arm-apple-darwin-gcc, but arm-apple-darwin10-llvm-gcc-4.2.

Open a terminal and enter

cd /Developer/Platforms/iPhoneOS.platform/Developer/usr

 ls bin/ 

You will now see a list of compilers available on your system. BTW: I don’t have an add-ons catalog, so I assume this is part of the special software package that you installed.

[ Update ]: The following flags are set in Xcode:

-x objective-c -arch armv7 -fmessage-length = 0 -pipe -std = c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -isysroot / Developer / Platforms / iPhoneOS. platform / Developer / SDK / iPhoneOS4.2.sdk -gdwarf-2 -mthumb -miphoneos-version-min = 4.2

I don’t know much about the details of each flag, but you should try installing them in CC inside your makefile.

+6
source

All Articles