Mail Archives: djgpp/1998/04/17/12:03:24
Hi!
Elias Pschernig <f DOT x DOT gruber-museum-arnsdorf AT magnet DOT at> schreef in artikel
<6h5eg3$dhp$1 AT orudios DOT magnet DOT at>...
>
> To use a .c file like a unit, you need to declare all functions and
> variables in a separate header file (example: "mouse.h") and include
> this in your program ("test.c"), as you include the "uses ..." in
> pascal.
>
> hope this is of any help,
> Elias Pschernig
>
I've tried this like the following:
=========== VESA.H ===========
#ifndef _VESA_H_
#define _VESA_H_
// prototypes, structures, vars, etc.
#endif
========== VESA.CPP ==========
#ifndef _VESA_CPP_
#define _VESA_CPP_
// function body's
#endif
========== MAIN.CPP ==========
include "vesa.h"
void main()
{
// function call to function in VESA.CPP
};
I get an "undefined reference" in main() on the line which calls the
function. The only way to solve this problem is to add the line '#include
"vesa.h"' to vesa.cpp, and to include vesa.cpp in the main program, not
vesa.h. Somehow i get the feeling this is not the way it is supposed to be
done... BTW: how can i convert an object file to a library?
Thanks,
Jasper.
- Raw text -