Google Ads

April 22, 2015

Setup Objective-C programming environment on Ubuntu Distributions

Objective-C is a programming language which expands C programming language by including Smalltalk object orientated programming language. It has robustness like C programming language as well as it is feature rich like C++ and Java. It fully supports object oriented programming including Encapsulation, Data hiding, Inheritance and Polymorphism. It is the main programming language for OS X and iOS application development.

GNU Compiler Collection (GCC) provides compiling support for Objective-C source files through GNUstep framework. It is very easy to setup Objective-C development environment on Ubuntu based distributions. We just have to install few packages on to our Ubuntu System.


From your favourite package manager just install the following packages:


gobjc

gnustep
gnustep-make
gnustep-common
gnustep-core-devel
gnustep-devel

Or in the terminal put the following command:


sudo apt-get install gobjc gnustep gnustep-make gnustep-common gnustep-core-devel gnustep-devel


Once all the packages are installed properly, you should be able to compile any Objective-C source file by entering the following command in the terminal:


gcc source.m `gnustep-config --objc-flags` -lobjc -lgnustep-base


This should produce a.out binary in the current directory.


For Example, put the following codes into a text editor and save it as Hello.m


#import <Foundation/Foundation.h>

int main(int argc, char *argv[])

{
    NSLog(@"Hello, World!\n");
   
   return 0;
}

Now, compile the source file Hello.m using following command in the terminal:


gcc Hello.m `gnustep-config --objc-flags` -lobjc -lgnustep-base


Now, run the executable file by putting following command in the terminal:


./a.out


You should see something like below in the terminal,


2015-04-22 19:24:26.483 a.out[31686] Hello, World!


April 12, 2015

Do Programming on Ubuntu/Kubuntu Linux

Programming on Linux
 
Linux in general is great development platform where the operating system's kernel itself is free and Open Source. So there is virtually no limit of what you want to do with your Linux computer. Kubuntu, Ubuntu and Gnome Ubuntu are all great Linux Desktop distributions with bleeding edge desktops and touch pad user interfaces. You pick your Linux distribution flavor and start working on your projects in no time. All Ubuntu variant distributions have common package names for development and application support.

Programming Language support


Ubuntu Linux by default comes with GNU Compiler Collection and you will find almost all of the software build for the system uses GNU Compiler Collection (GCC). With GCC you can program for C, C++, Objective-C, Objective-C++, Fortran, Java, Ada, Go and many other programming languages. One good thing about GCC is that it is available for many different operating systems for example Microsoft Windows, Apple Mac OS. Furthermore, GCC is supported on all major CPU architectures.


Programming in C and C++ languages


GCC will give you gcc compiler and g++ compiler for C and C++ source files respectively. Both gcc and g++ compiler support almost all existing C standards for example ANSI C, ISO C, C99 and C11.


Installation of required packages


To get minimal development environment with C and C++ compilers, install the following packages under Ubuntu distributions:


build-essential

autoconf
automake
flex
bison
libtool
gcc-multilib
g++-multilib

in the terminal:


sudo apt-get install build-essential autoconf automake flex bison libtool gcc-multilib g++-multilib


Then, install manual pages which will help you understand function definitions.


in the terminal:


sudo apt-get install manpages-dev manpages-posix


Now, you can start writing your programs in the text editor of your choice  and compile your source files easily from the terminal by putting the following command:


For C program:


gcc source_file.c


For C++ program


g++ source_file.cpp


This will produce executable file named a.out in the current directory.


If you want to read manual of a function just type the following in the terminal:


man name_of_the_function


For example:


man printf


to exit from manual press q keyboard key. Use Up and Down arrow key to navigate through the manual.


If you prefer Integrated Development Environment (IDE) then check out the following IDEs. Here I put my experiences with different IDEs:


Netbeans

Build on Java, solid user interface, recommended for all kind of developments
https://netbeans.org/

Code::Blocks

Uses native user interface, simple and good for experimentation and start-up projects
http://www.codeblocks.org/

Eclipse

Build on Java, Extensible in nature
https://eclipse.org/

KDevelop

Native KDE development environment, good for C++ and QT projects
https://www.kdevelop.org/

Geany

Lightweight native IDE, good for simple projects
http://www.geany.org/

Finally, if you ask me which IDE I would prefer, I would definitely say Netbeans :)