linux-ubuntu14.04 OBJECTIVE-C Environment Construction

Source: Internet
Author: User

Get started with iOS development, start with the most basic environment, and today we'll look at how to fully match the OBJECT-C environment.

My Linux system is ubuntu14.04. Given that there is no money to buy a MacBook, the black Apple Computer card can't keep up.

So...

first with environment: sudo apt-get install GNUstep Gnustep-devel GOBJC (Ctrl + ALT + T call out cmd input command, to be networked download)

open .BASHRC ,
sudo gedit. BASHRC (command line)


After opening, add at the bottom
Gnustep_path=/usr/share/gnustep
Export Gnustep_path
source/usr/share/gnustep/makefiles/gnustep.sh

Here, the environment is well equipped to start testing.


To build a simpleHELLOWORLD.MFile input
#import <stdio.h>

int main (int argc, const char * argv[])
{
printf ("Hello world\n");
return 0;
}
and then compilegcc Helloworld.m-o Hello
./helloSuccess

One more.
#import <Foundation/Foundation.h>
int main (int argc, const char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog (@ "Hello world!");
[Pool drain];
return 0;
}

This time the compiler should pay attention to, because the reference to the header file, the compilation requires some parameters to succeed, or will report a bunch of errors
GCC ' gnustep-config--objc-flags '-lgnustep-base hello.m-o Hello


Make a Makefile

app:$ (s)
@gcc ' Gnustep-config--objc-flags ' $ (s)-O app-lobjc-lgnustep-base
@./app
@rm *.D
@rm app


Note: The first two sentences are to compile and execute the code

The latter two sentences refer to the deletion of the resulting file

The @ symbol is used here to make the command batch not display text


Run:

CD-To-code path

Run the makefile command followed by the s= file name


linux-ubuntu14.04 OBJECTIVE-C Environment Construction

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.