?
Solved

C++ Program will not compile on linux

Posted on 2003-02-27
6
Medium Priority
?
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: 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!

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

771 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