From: "Jasper van Woudenberg"
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pascal units in c++
Date: 17 Apr 1998 15:45:52 GMT
Organization: World Online
Lines: 48
Message-ID: <01bd6a17$6954d040$151601bf@cb001687>
References: <01bd6894$499fcd60$151601bf AT cb001687> <6h4hu8$hba AT news DOT u-strasbg DOT fr> <01bd694d$74dbc4c0$151601bf AT cb001687> <6h5eg3$dhp$1 AT orudios DOT magnet DOT at>
NNTP-Posting-Host: asd1-p238.worldonline.nl
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Precedence: bulk
Hi!
Elias Pschernig 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.