From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Wimpey To: help-gcc@gnu.org Subject: Re: help, gcc, ?cout error? Date: Mon, 13 Dec 1999 10:01:00 -0000 Message-id: References: <3852d685.22627268@usenet.nau.edu> <3852FC1C.1DFC5B1B@csuhayward.edu> <3853018b.33642768@usenet.nau.edu> <3853CDE3.331411D4@mindspring.com> <3853e4af.91799515@usenet.nau.edu> X-SW-Source: 1999-12/msg00204.html aka007@mail.com writes: > thanks for letting me know what the diff was with gcc vs g++... > > hope this is still valid here? anyhow, here is current version of my > "hello" program: > > UW PICO(tm) 2.9 File: a.cpp > > #include > using namespace std; > > int main() { > cout << "hello"; > return 0; > } > > using command g++ -o a a.cpp , then it "thinks" for a moment, but > creates no output on the telnet session screen. pico a.out reveals an > empty file, no "hello" in there at all... at least no error > messages. > Does your code really say "#include "? That should be "#include ", unless GCC has some facility for automagically tacking the ".h" onto the end of the file name. Second, the command line "g++ -o a a.cpp" will put the compiled code in a file called "a", not "a.out". You'll only see output in "a.out" if you don't give it an output file name with the "-o" flag. Finally, you shouldn't expect to see "hello" in your compiler output. Your compiler output will be the executable, not the output of the program. You need to execute the code; then you'll see the output. It should go something like this: % g++ -o a a.cpp % ./a hello % (Note that the lack of a newline ("\n") in your string means that the prompt will appear on the same line as your output.) -- Greg Wimpey greg.wimpey@waii*removetomail*.com.invalid From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Wimpey To: help-gcc@gnu.org Subject: Re: help, gcc, ?cout error? Date: Fri, 31 Dec 1999 22:24:00 -0000 Message-ID: References: <3852d685.22627268@usenet.nau.edu> <3852FC1C.1DFC5B1B@csuhayward.edu> <3853018b.33642768@usenet.nau.edu> <3853CDE3.331411D4@mindspring.com> <3853e4af.91799515@usenet.nau.edu> X-SW-Source: 1999-12n/msg00204.html Message-ID: <19991231222400.wnDum7am3Yx3vRmWIUaDMKHblO2SnvUD9B2yb0r3qNY@z> aka007@mail.com writes: > thanks for letting me know what the diff was with gcc vs g++... > > hope this is still valid here? anyhow, here is current version of my > "hello" program: > > UW PICO(tm) 2.9 File: a.cpp > > #include > using namespace std; > > int main() { > cout << "hello"; > return 0; > } > > using command g++ -o a a.cpp , then it "thinks" for a moment, but > creates no output on the telnet session screen. pico a.out reveals an > empty file, no "hello" in there at all... at least no error > messages. > Does your code really say "#include "? That should be "#include ", unless GCC has some facility for automagically tacking the ".h" onto the end of the file name. Second, the command line "g++ -o a a.cpp" will put the compiled code in a file called "a", not "a.out". You'll only see output in "a.out" if you don't give it an output file name with the "-o" flag. Finally, you shouldn't expect to see "hello" in your compiler output. Your compiler output will be the executable, not the output of the program. You need to execute the code; then you'll see the output. It should go something like this: % g++ -o a a.cpp % ./a hello % (Note that the lack of a newline ("\n") in your string means that the prompt will appear on the same line as your output.) -- Greg Wimpey greg.wimpey@waii*removetomail*.com.invalid