?
Solved

linux programming

Posted on 2004-11-09
5
Medium Priority
?
211 Views
Last Modified: 2010-04-15
how do i create a program in c++ using linux.  do i just use the vi editor?
0
Comment
Question by:jfeltus
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
Axter earned 100 total points
ID: 12538522
>>how do i create a program in c++ using linux.  do i just use the vi editor?

You can use the vi editor, but you still need a compiler to create the executable.

You should have a GNU compiler that you can use.
0
 
LVL 30

Expert Comment

by:Axter
ID: 12538555
Most Linux installations have better text editors you can use for developing the souce code.

What version of Linux do you have?

To compile your code, go to the command line, and enter the following:
gcc myfile.c

or
g++ myfile.c

Make sure you're in the same path that your text file is in before issuing the above command line.
0
 
LVL 9

Assisted Solution

by:Hamed Zaghaghi
Hamed Zaghaghi earned 100 total points
ID: 12562359
hi,

first you can use an editor , for example vi, emacs, mcedit, ...
and then if you write your code in c++, use g++, and if you write your code in c, use gcc.
for example;

g++ myprogram.cpp

that compile and link your code and make an executable file named `a.out',

g++ myprogram.cpp -o myprogram

that compile and link your code and make an executable file named `myprogram'.

some hint:

1- you can use `make' utility to make your executable code:

make myprogram

2-if you want to debug your code you must use `gdb'

3-if you want to debug your code with gdb you must add debugging information inyour executable file like this:

g++ -gstabs+ myprogram.cpp -o myprogramm

4-for better programming and debugging in linux, and if you have an X in your linux, you can choose KDevelope for programming,
or other opensource and free IDEs for c/c++ like `anjuta'.


have a good programming day;


0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question