I have been playing with my beagleboard for a while writing little
programs in C and then compiling them on the beagle board with gcc on
Angstrom. Now I want to use C++ but the problem is that the g++
compiler is giving me loads of trouble with no explanation.
Before I go on the contents of the file is
#include <iostream>
using namespace std;
int main()
{
int thisisanumber;
cout<<"Please enter a number: ";
>> thisisanumber;
cin.ignore();
cout<<"You entered: "<< thisisanumber <<"\n";
cin.get();
}
I have a c++ file named output.cpp on a flash drive, so I went into
the drive and typed this. (I have tried it in other combinations with -
o and -Wall with no luck as well).
g++ output.cpp
Now this should compile without a problem and create a file called
a.out that I can run by typing ./a.out but it doesn't work. When I
press enter g++ starts and then just hangs at the command line,
nothing happens and I end up having to abort the process. Then I found
a.out on the flash drive! But when I try to open it I get an error
message saying that the "text file is busy". So I unplugged the flash
drive and plugged it back in then tried to run a.out and it tried to
run it but gave me this error
./a.out" line 1: syntax error: "(" unexpected
I thought for a second that something was missing so I tried
installing gcc again and it told me that everything was up to date so
this can't be the problem plus the Angstrom image I have should have
come with this all to begin with.
I find this to be strange because I can compile and run C programs but
not C++ programs with gcc.
Do any of you guys have an idea of what might be wrong? Am I missing
something in my code or am I typing the command wrong ect...?