Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

C++ Program will not compile on linux

Posted on 2003-02-27
6
Medium Priority
?
221 Views
Last Modified: 2010-04-01
I cannot get this to compile using g++ in Mandrake 9.0 when I type the command "g++ valuecopy.cpp"

#include <iostream>
#include <stdlib.h>
int main(int argc, char *argv[])
{
        int start = 50;
        int finish;
        finish = start;
        cout << finish << endl;

        return 0;
}
0
Comment
Question by:webc0der
6 Comments
 
LVL 11

Expert Comment

by:cup
ID: 8040203
Between your last include and main, add

using namespace std;
0
 

Expert Comment

by:phildsp
ID: 8040267
The first include is missing the ".h":

#include <iostream>   ->
#include <iostream.h>
0
 

Expert Comment

by:phildsp
ID: 8040373
Ignore the last comment please.  That will work but it would have been the best answer 15 years ago.  (Some of us go way, way back)
0
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.

 

Accepted Solution

by:
alexanderthegreat earned 80 total points
ID: 8040559
Just include "using namespace std;"
And then it works easy as that.

You should get "Anjuta" its free, the best compiler
for Linux.
0
 
LVL 8

Expert Comment

by:Exceter
ID: 8042638
>> Just include "using namespace std;"

cup already said that. :-)

Exceter
0
 

Expert Comment

by:alexanderthegreat
ID: 8043334
Oh well i did not see that, thanks for letting me know thought.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

578 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