Sunday, December 18, 2011

Start your first program in Linux using a nice IDE Geany | Ubuntu 14.04


In Previos post i had written about how to work with codeblocks in ubuntu 14.04. Now i have found another nice IDE name “Geany”. Now i will discuss about how to install and work with it. Using this you can work with C, C++, Java, JavaScript, PHP, HTML, CSS, Python, Perl, Ruby, Pascal and Haskell.

Open the terminal and write =>
$ sudo apt-get update
$ sudo apt-get install build-essential
$ sudo apt-get install geany
Open Geany from dashboard.



 Then File – New with Template- main.c . You can see as like as this =>


You can see copyright message. delete it using backspace and write your program. If you think you program font size is so small. You can change it by clicking view- change font. here you can change your font size.



 After writting your program save your program in Home directory. Don’t put it in another directory.


To compile the program click F9. and to run click F5. You can do the same process using icon.



 Now see the output.




To do programming in Linux you must keep some ideas.
#include <stdio.h>
#include <conio.h>
void main()
{
int a=10;
clrscr();
printf(” value is: %d”,a);
getch();
}
You may be well known this stucture. Forget it. You have to write like this =>
#include <stdio.h>
/* no need to use #include <conio.h> */
int main() /* don’t use void main(). please use  int main() */
{
int a=10;
/* don’t use clrscr() */
printf(” value is: %d”,a);
return 0; /* don’t use getch() । use return 0;  */
}
I hope you understand. If you face any problem don’t hasitate to comment here.



No comments:

Post a Comment