Mail Archives: djgpp/1998/04/17/12:31:16
Jasper van Woudenberg writes:
> ========== VESA.CPP ==========
> #ifndef _VESA_CPP_
> #define _VESA_CPP_
>
> // function body's
>
> #endif
There is no need for this in a C source file. The reason why these
defines are commonly placed around the contents of a header file, is
to prevent the file accidentally being included twice in a single
compile (eg. if a source included a particular header, but then also
included a different header which in turn includes the first header,
an error would occur if the contents of the first header were parsed
twice). C files must only ever be built once in any case, so this
cannot be a problem.
> I get an "undefined reference" in main() on the line which calls the
> function.
You need to compile your module source (the .c file) into a .o file,
and then include this on the gcc command line when you build your
main program. For more information see the djgpp User's Guide
(http://www.delorie.com/djgpp/doc/ug/), or any decent C book: this
sort of basic language information is not really appropriate for
the djgpp newsgroup.
> BTW: how can i convert an object file to a library?
Use the ar program. See "info binutils ar".
Shawn Hargreaves.
- Raw text -