Getting started with Objective C in Linux


Objective C is a general purpose, object-oriented programming language and is used by Apple for iOS and OS X operating system. Objective C source code program have a .m extension with their hearder files with extension .h.



Installing GNUStep in ubunut:
    sudo apt-get install gnustep gnustep-devel gobjc

Let's write the first objective C program which will print 'Hello World':
File: hello.m
  
   #include 

  int main(int n, char** argv) {
    printf("Hello World \n");
    return 0;
  }


We can compile the above program with the command :
gcc -o hello hello.m
And then we can run the compile program with the command
./hello

If you compile simply as gcc hello.m then the compiled program would be a.out which you can run as ./a.out

Comments

Popular posts from this blog

Automate file upload in Selenium IDE

How To Install and Configure Nextcloud