c in linux

hii friends I am a beginner in Linux and I want to run my c programme in Linux how I run please describe in brief steps..........
How have you written it?

How would you run it, if you were in Windows?
I doesn't understand what do you want to say or ask?
Are you asking how to compile your program? Use the GNU C++ compiler:

$: g++ -o myprog file1.cc file2.cc file3.cc


Then simply run your program:

$: ./myprog


Or put it somewhere in the path(try echo $PATH) and you can run it like any other program:

$ : myprog


Maybe you should find a book or tutorial on using GCC.

Edit: OK you said C, not C++. So use gcc instead of g++ and the rest is the same.

Hope this helps. I have done no C/C++ programming in Linux so it's possible I have no idea what I'm talking about ^-^
Last edited on
I think your suggestion should help me thanx.........
Step 1. Open up a terminal
Search for the terminal application in the Dash tool (located as the topmost item in the
Launcher). Open up a terminal by clicking on the icon.
For ease of future access to the terminal application, right click its icon in the Launcher and
select “Lock to Launcher”.

Step 2. Use a text editor to create the C source code.
Type the command
gedit hello.c
and enter the C source code below:
#include <stdio.h>
main() {
printf("Hello World\n");
}
Close the editor window

Step 3. Compile the program.
Type the command
gcc -o hello hello.c
This command will invoke the GNU C compiler to compile the file hello.c and output (-o)
the result to an executable called hello.

Step 4. Execute the program.
Type the command
./hello
This should result in the output
Hello World

Optional step
In order to avoid the./ prefix each time a program is to be executed, insert the following as
the last line in the file .profile (located in your home folder):
export PATH=.:$PATH
This step needs only to be done once.

http://www.besanttechnologies.com/training-courses/android-training-institute-in-chennai | http://www.besanttechnologies.com/training-courses/software-testing-training
Topic archived. No new replies allowed.