[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: g++ file doesn't run



Jeff Shilt wrote:
>Thanks for the help - it does compile with g++ instead of gcc, but the executable produced isn't d
>oing anything.  Here's what i'm doing:
>
>//test.c
>#include <iostream.h>
>
>main(){
>  cout << "Hello there.";
>}
>
>The test file doesn't print out anything when I run it.
>
>Also, I was wondering if this was a descrepency in versions of gcc.  The installaition I had befor
>e (using the main parts of the Slackware dist.) compiled both c and c++. Like somehow it knew whic
>h way to process it.
>
>

Don't call it "test" and don't end it in ".c".  Try .cc or .CC or
even .C because the compiler will look at the extension.

g++ -o filename filename.cc 

will name the exec. the same as the input w/o the .cc extension.

--kmb203@psu.edu----------------Debian/GNU--1.2---Linux--2.1.25---
<kmb203@psu.edu>  <bealer@cse.psu.edu>  <kmb203@kmb203.rh.psu.edu> 
------------------------------------------------------------------
A computer lets you make more mistakes faster than any other
invention, with the possible exceptions of handguns and Tequilla.
	-- Mitch Ratcliffe


Reply to: