www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/17/17:16:47

From: "Elias Pschernig" <f DOT x DOT gruber-museum-arnsdorf AT magnet DOT at>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pascal units in c++
Date: Fri, 17 Apr 1998 10:11:24 +0200
Organization: magnet Internet Services
Lines: 61
Message-ID: <6h8d1s$20b$1@orudios.magnet.at>
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> <01bd6a17$6954d040$151601bf AT cb001687>
NNTP-Posting-Host: 195.3.67.133
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

-----Ursprüngliche Nachricht-----
Von: Jasper van Woudenberg <p DOT v DOT woudenberg AT consunet DOT nl>
Newsgroups: comp.os.msdos.djgpp
Datum: Freitag, 17. April 1998 17:45
Betreff: Re: Pascal units in c++

>
>I've tried this like the following:
>
>=========== VESA.H ===========
>#ifndef _VESA_H_
>#define _VESA_H_
>
>// prototypes, structures, vars, etc.
>
>#endif
>

thats it

>========== VESA.CPP ==========
>#ifndef _VESA_CPP_
>#define _VESA_CPP_

you dont need the tow lines above,
but its good to include the header,
like #include "vesa.h"

>
>// 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?

if you defined the prototypes in the right way, you dont get an "undefined
reference". I think you must have made a spelling mistake when
defining the prototypes.
but you must tell the linker which programs (.o files) he should linkt
together
to an .exe, otherwise the linker will give an error
I personally use Rhide to do this, it does all the work for you, just like
the
pascal-compiler.

Elias Pschernig


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019