Page 1 of 1
gedit
Posted: Tue Nov 01, 2011 4:14 pm
by amlansaha
Can anyone tell me how i can compile a code witten in gedit? please reply me soon.
Re: gedit
Posted: Wed Nov 02, 2011 4:40 am
by novice
Gedit is basically for editing ( I am guessing ). However,you can compile and run from it with the help of something called RunC. Follow the instructions here
http://www.ioi2010.org/environment/runc.shtml
Using RunC is very easy.Ctrl+R will do the compiling and running.Its not the best of options however.
My advice,install geany in ubuntu =) Its really Cool =)
Let us know what you coded
Re: gedit
Posted: Wed Nov 02, 2011 4:42 am
by novice
I guessed you are using C and C++. If not,I apologize for wasting your time
Re: gedit
Posted: Thu Nov 03, 2011 1:55 pm
by amlansaha
yes i am using c. RunC is also cool
thank you very much. i shall also try geany.
Re: gedit
Posted: Thu Nov 03, 2011 8:37 pm
by Corei13
Go to terminal and type:
Code: Select all
sudo apt-get install gedit-plugins
After installing it go to Gedit > Edit > Preference > Plugins
Then tick Embedded terminal.
Now write a code, suppose something.c, when you need to compile it hit Ctrl+F9 and then enter
. If compilation is OK, enter
to run.
For C++ you need to install g++, go to terminal and type
And to compile a code named something.cpp enter
Running process is same as C.
Re: gedit
Posted: Thu Nov 03, 2011 11:20 pm
by amlansaha
Corei13 wrote:Go to terminal and type:
Code: Select all
sudo apt-get install gedit-plugins
After installing it go to Gedit > Edit > Preference > Plugins
Then tick Embedded terminal.
Now write a code, suppose something.c, when you need to compile it hit Ctrl+F9 and then enter
. If compilation is OK, enter
to run.
I tried to compile this code
Code: Select all
#include <stdio.h>
int main()
{
int a, b, sum;
scanf("%d", &a);
scanf("%d", &b);
sum = a + b;
printf("Sum is: %d\n", sum);
return 0;
}
when i hit ctrl+F9 & enter gcc something.c it shows
/usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
what's the problem?
Re: gedit
Posted: Thu Nov 03, 2011 11:46 pm
by Corei13
Your code is compiled in my pc without any problem. :-/
Try updating gcc: sudo apt-get install gcc
Re: gedit
Posted: Sat Nov 05, 2011 12:40 pm
by amlansaha
it works
আমি কোডটারে সেভ না করেই কম্পাইল করতে গেছিলাম। এরর তো আসবেই। what a fool i am.
btw, thanks dj
Re: gedit
Posted: Fri Feb 17, 2012 4:48 pm
by qeemat
Gedit is only designed to be a really good editor, not an IDE.
If you have a proper makefile then I believe F8 or F9 is the shortcut key to have gedit run 'make' in the current directory...
Otherwise just switch to the shell prompt and run the GCC yourself:
% g++ -Wall myprog.cpp -o myprog
% ./myprog
The first line compiles "myprog.cpp" into an executable named "myprog" (instead of "a.out").
Assuming there are no errors, the second line executes your program.
If your shell is locked because you started gedit with
% gedit myprog.cpp
instead of
% gedit myprog.cpp &
then you can fix it by:
1. Make sure the terminal window is active
2. Press Ctrl+Z to suspend the foreground process (gedit)
3. Type
% bg 1
to move job 1 (your gedit process) to the background.
If you have more than one process running, you can learn the job number by asking
% jobs