Write the first program with Objective-c--hello,world!

Source: Internet
Author: User

No matter which programmer, or what computer language to learn, the first program written is basically Hello world. Today we use OC to implement the first program: Hello World.

Select Create a new project in Xcode, select OS X in the dialog box, select Application below, select command line tool on the right, indicate that you are using shell, click Next, enter the project name in the next dialog, and select the development language. You can see that you can choose the Swift,oc,c++,c language here, and finally select the workspace directory and click Create to build the project.

After the project is created, open the main.m file and discover that the following code has been automatically generated:

#import <foundation/foundation.h>int Main (int argc, const char * argv[]) {    @autoreleasepool {        //insert Cod        e here ... NSLog (@ "Hello, world!");    }    return 0;}

Haha, it seems to print the hello,world! The code system has been written for us. Directly click the Run button in the upper left corner and discover that it has been output in the console: hello,world! :


OC's first program is finished, do not need us to write a line of code, haha.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Write the first program with Objective-c--hello,world!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.