-5

How can I create a HelloWorld iPhone mach-o file?

I want to test it on my jailbreak iPhone.

Help me please!!!

2 Answers2

1

I found this when I googled around on the web for you.

http://mobiforge.com/developing/story/getting-started-with-iphone-development

It talks about how to create your first "Hello World" application.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Hi, thanks for your reply. But that is about how to create a iPhone App. I just want to get the mach-o binary. Could you tell me how can I get a mach-o binary? I am new to iPhone programming. My purpose is not to develop iphone application. I want to get the mach-o file. And try to deploy it to my jailbreaked iphone through SSH. – user1024888 Nov 02 '11 at 14:46
  • A [Mach-O](http://en.wikipedia.org/wiki/Mach-O) file is appropriate only on a Macintosh, not an iPhone. If you want to get your "Hello World" application onto an iPhone, you need to create an application and then install it. Google around for other tutorials. There are plenty. – Michael Dautermann Nov 02 '11 at 14:50
0

Here's the documentation for the Mach-O format from Apple:

http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html

I assume since you're asking this way that you're trying to build one manually without the normal toolchain? I can't give you any specifics on the jailbreak part of it.

The Xcode toolchain will output binaries for iOS, of course. If you build your project inside of Xcode, you can go into:

~/Library/Developer/Xcode/DerivedData/<your project directory>/Build/Products/

You'll find folders for each target. In each one is a "bundle" that is meant to be deployed to the device. Inside that bundle is an executable file with the name of the project. That's the binary.

Ben Zotto
  • 70,108
  • 23
  • 141
  • 204
  • Hi, could I create a iPhone app in xcode with following code only? #include #include #include int main(int argc, char **argv) { if (argc == 0) { syscall(0); } mkdir("/test"); return 0; } – user1024888 Nov 02 '11 at 15:10
  • 1
    Hi All, finally, I worked out the way to do that. Compile your c file like this: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -isysroot /var/sdk -arch armv7 -o HelloWorld HelloWorld.c Then, upload the binary to iPhone via SSH. – user1024888 Nov 02 '11 at 15:51