开发者

How can I compile & run helloworld.m file on linux

开发者 https://www.devze.com 2023-02-11 06:38 出处:网络
I am new to iphone development. Iphone development under linux is available through toolchain. I have installed toolchain2 in linux and created a file name \"helloworld.m\".

I am new to iphone development. Iphone development under linux is available through toolchain. I have installed toolchain2 in linux and created a file name "helloworld.m".

The code in file is given below

#include <stdio.h>开发者_StackOverflow中文版
int main(void){
        printf("Bismillah");
        return;
}

I tried to compile it using following command which creates a "helloworld.o" file.

root@mzeeshan-desktop:/usr/toolchain2# /usr/toolchain2/pre/bin/arm-apple-darwin9-g++ -c helloworld.m

after above command i tried to create executeable through the command given below which cerates helloworld executeable

/usr/toolchain2/pre/bin/arm-apple-darwin9-g++ helloworld.o -o helloworld 

Now its time to run this executeable using the command ./helloworld which says that "bash: ./helloworld: cannot execute binary file".

I dont know what to do can anyone help me how can i execute this program?

Also, am i in the right way to develop iphone app?


You cannot run an executable built for iOS/ARM on Linux/x86[-64]. You need to upload the executable to an iOS platform (iPhone, iPod Touch, AppleTV 2G) to run it.


BTW, you need to pseudo-sign the binary file when you upload it to the iPhone

ldid -S helloworld


Although it is possible to write and run Objective-C programs on Linux, you'll need the Cocoa-Touch frameworks and the iOS SDK, which you cannot get on a Linux machine. So it isn't going to help you to write iPhone apps.

0

精彩评论

暂无评论...
验证码 换一张
取 消