Mail Archives: djgpp/1997/01/08/03:15:33
Gautam N. Lad wrote:
>
> When I compile my C++ program and link it to the graphics library,
> instead of the executable file having the same name as the source
> file, it's A.EXE and so is the .OUT file (A.OUT).
>
> I am compiling like this in C:
> gcc prog.c
>
> I am compiling like this in C++
> gxx tb.cpp window.cpp /djgpp/contrib/grx20/lib/LIBGRX20.A
Did you actually read the DJGPP documentation or just start compiling
"out of the box"? Try reading 'readme.1st', which gives several
examples of command lines, and the documentation for gcc, which explains
everything.
To specify the name of the output file from gcc, use the '-o' parameter
like so:
gcc -o prog.exe prog.c
This will output 'prog.exe'.
As for your C++ example, you aren't linking the library right. All you
need to do is use the '-l' parameter to specify the library. So that
example would be:
gxx -o tb.exe tb.cpp window.cpp -lgrx20
This will link your program using [lib]grx20[.a], and output 'tb.exe'.
There are some other parameters that you should use most of the time:
-Wall Reports lots of warnings that aren't on by default.
-O Optimize
-g Include debugging information in the executable.
This would make the above command lines into:
gcc -Wall -O -g -o prog.exe prog.c
gcc -Wall -O -g -o tb.exe tb.cpp window.cpp -lgrx20
You can use gcc parameters for lots more things as well; read the
documentation!
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com |
| Plan: To find ANYONE willing to | http://www.cs.com/fighteer |
| play Descent 2 on DWANGO! | Tagline: <this space for rent> |
---------------------------------------------------------------------
- Raw text -