Friday, September 2, 2011

[C/C++] Programing in Ubuntu (by commend line)

1. Needs to install the compiler: Which includes the libc-dev, gcc, g++, make and dpkg-dev which should suffice for C/C++ programming.
      Commend line:  sudo apt-get install build-essential 

2. In a chosen folder, right click and choose "Create Document > Empty File" to create a file. Name it filename.c.

3. Double click the file to open it. Write your program in the file and save.

4. Open terminal. Switch to the file directory in which the file is in.
      Commend line:  cd ./foldername1/foldername2 

5. Compile the file.
      Commend line(for C):  gcc filename.c 
      Commend line(for C++):  g++ filename.c 

6. Show output.
      Commend line:  ./a.out 

No comments:

Post a Comment