This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Make Executable File
- To: Mike White <jmwhite at mail dot hot1 dot net>
- Subject: Re: Make Executable File
- From: Jan Dvorak <johnydog at go dot cz>
- Date: Fri, 26 Nov 1999 10:12:30 +0100 (CET)
- cc: help-gcc at gnu dot org
On Thu, 25 Nov 1999, Mike White wrote:
> I'm just starting to learn C++ and the G++ compiler. I have been
> able to write and compile a couple of programs successfully, but
> for the life of me I can't find out how to make the resulting object file
> an executable. While using DJGPP through DOS it creates the
> executables automatically. The problem I"m having is using G++
> under Linux. I've read man pages and info files until my eyes
> crossed. Could someone please help me get my eyes back in
> focus by pointing me to the information I need?
>
>
> J. Michael White
> Lorena, Texas
> jmwhite@mail.hot1.net
> http://genealogy.org/~mwhite
>
Well, this can be caused by many things. First, make sure, that code is
ok, and compiler compiled it ok (no error messages etc). Second, make sure
that you don't set the '-c' option (which means stop after compile and DO
NOT link). Third, look if you have included '-o' option - the name of
resulting executable. (Without that, the executable will be named
'a.out') So, with all this the syntax for compiling should be:
g++ program.c -o program
This will create file 'program'. You can run it by typing:
./program
(remember, that in linux you nedd to type leading './' when you are
running programs which are in current directory (and that directory is not
in path)
Happy coding
Jan Dvorak