Link to home
Start Free TrialLog in
Avatar of webc0der
webc0der

asked on

C++ Program will not compile on linux

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;
}
Avatar of cup
cup

Between your last include and main, add

using namespace std;
The first include is missing the ".h":

#include <iostream>   ->
#include <iostream.h>
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)
ASKER CERTIFIED SOLUTION
Avatar of alexanderthegreat
alexanderthegreat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> Just include "using namespace std;"

cup already said that. :-)

Exceter
Oh well i did not see that, thanks for letting me know thought.