[Objective-C] 03-first OC Program

Source: Internet
Author: User

Note: This Objective-C topic is a prelude to iOS development. It also helps programmers with experience in object-oriented language development to quickly get started with Objective-C. If you have no programming experience or are not interested in Objective-C or iOS development, ignore this. Before learning this topic, we recommend that you first study the C language topic.

1. Open Xcode and create an Xcode Project

 

2. Select the simplest Command Line Project

Because we only learned the OC syntax and haven't officially started iOS development, select the command line project.

 

3. Enter a project name and select Foundation framework to create a project.

 

* You must select the Foundation framework for Type, because common classes of OC are included in this framework.

* Do not select the "Use Automation..." option at the bottom, which is related to memory management. Let's talk about memory management.

 

4. Click Run to Run the project.

* C language source file extension name ". c", OC source file extension name ". m"

* The main. m file is the only source file in our program.

* The compiler will compile the. m file as the. o target file. For example, after main. m is compiled successfully, it will become the main. o file.

* The running result is:

15:35:32. 583 the first OC program [429: 303] Hello, World!

The first OC program runs successfully!

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.