Connecting Tech Pros Worldwide Forums | Help | Site Map

undefined reference

Kees Hoogendijk
Guest
 
Posts: n/a
#1: Jul 22 '05
Hi everyone,

Actually I dont know how te explein this, that's why I paste my code below.
I've a main en I've a few header files. After I include the headers, the
compiler shows the errors as this exempel.

Can someone tell me what is here going on?

Tia

Regard,

Wen



Exempel Error:



C:\DOCUME~1\kees\LOCALS~1\Temp\ccCQaaaa.o(.text+0x 12f)

[Warning] In function `main':



[Linker error] undefined reference to `Verslag(std::basic_ofstream<char,
std::char_traits<char> >&, Constant&, Client&, ClientHistory&, int)'



AEdi.cpp (main):



#include <iostream>

#include <string>

#include <fstream>

#include <iomanip>

#include "Decl.hpp"

#include "LeesVerzoeken.hpp"

#include "OpenBestanden.hpp"

#include "SorteerKlant.hpp"

#include "SorteerHistorie.hpp"

#include "SorteerVerzoek.hpp"

#include "LeesKlant.hpp"

#include "Verslag.hpp"

#include "SluitBestand.hpp"

#include "LeesKlantHistorie.hpp"



int main()

{

<code>

}



Verslag.hpp:



#ifndef _Verslag_hpp

#define _Verslag_hpp

#include <iostream>

#include <ctime>

#include <string>

#include <fstream>

#include <iomanip>

#include "Decl.hpp"



using namespace std;

void Verslag ( ofstream& verslag, Constant& ConstantRec, Client& MasterRec,
ClientHistory& KlantHisRec, int klantNr);

#endif





Decl.hpp:



#ifndef _Decl_hpp

#define _Decl_hpp

const int HV= 99999;



struct Client

{

int klantNr;

char soort;

char naam[26];

char adres[26];

char postcode[7];

char plaats[16];

int bankNr;

int giro;

char mutcode;

char tariefAfspr;

};



struct ClientHistory

{

int klantNr;

int recType;

int ingangsDatum;

int volgNr;

int datumWijziging;

char boekSoort[5];

int datumEinde;

float afwijkendTarief;

float vastBedrag;

int maxEenheden;

char omschrijving[31];

char soort;

char naam[26];

char adres[26];

char postcode[7];

char plaats[16];

int bankNr;

int giro;

};



struct Date

{

int dag, maand, jaar;

};



struct Constant

{

Date datumHd;

int dagAanduiding;

char kantoor[16];

char adres[16];

char postcode[7];

char plaats[15];

int giro;

};



struct Request

{

int klantNr;

char aanvrager [15];

char afdeling [10];

};

#endif





void
Guest
 
Posts: n/a
#2: Jul 22 '05

re: undefined reference


Użytkownik Kees Hoogendijk napisał, On 2004-01-12 12:10:
[color=blue]
> Hi everyone,
>
> Actually I dont know how te explein this, that's why I paste my code below.
> I've a main en I've a few header files. After I include the headers, the
> compiler shows the errors as this exempel.
>
> Can someone tell me what is here going on?
>
> Tia
>
> Regard,
>
> Wen
>
>
>
> Exempel Error:
>
>
>
> C:\DOCUME~1\kees\LOCALS~1\Temp\ccCQaaaa.o(.text+0x 12f)
>
> [Warning] In function `main':
>
>
>
> [Linker error] undefined reference to `Verslag(std::basic_ofstream<char,
> std::char_traits<char> >&, Constant&, Client&, ClientHistory&, int)'
>[/color]

Here You have declaration for Verslag function but I couldn't find
implementation for this function. Maybe Yoo have it in your cpp file ??
Is it compiled ?? Have You told your linker where is this compiled file ??

Darek Ostolski
--
lint's little mind is blown.
Kees Hoogendijk
Guest
 
Posts: n/a
#3: Jul 22 '05

re: undefined reference


Hallo Darek,
In the Verslag.cpp I have also included the hpp as below. I dont understand
hoe kan the compiler show error wiht " undefined ".
Best Regards,
Wen


Verslag.cpp:

#include "Verslag.hpp"

void Verslag ( ofstream& verslag, Constant& ConstantRec, Client& MasterRec,
ClientHistory& KlantHisRec, int klantNr)
{
static int count = 0 ;
int dagH, maandH, jaarH;
ifstream Vastgegevens;
Vastgegevens.open("contant.csv");
SystemDate(dagH, maandH, jaarH);
Request RequestRec ;
//Bij meer dan 60 regels maak een header.
if(count == 0 || count%60 == 0)
{
verslag << "Kantoor: " << ConstantRec.kantoor
<< " Overzicht klantNr: "<< klantNr
<< " Datum: "
<< dagH << "-" << maandH << "-" << jaarH
<< " blad: " << (count/60)+1 << endl;
verslag << "Aanvrager: " << RequestRec.aanvrager<<endl;

count += 2;
}
verslag<< MasterRec.naam << endl
<< MasterRec.adres << endl
<< MasterRec.postcode <<" "<< MasterRec.plaats << endl;
verslag << "Soort Afwijkend tarief (Maximum eenheden)" << endl;
verslag << "----- ----------------- ------------------" << endl;

count +=5 ;

verslag << setw(8) << KlantHisRec.boekSoort
<< setw(16) << KlantHisRec.afwijkendTarief
<<setw(15) << KlantHisRec.maxEenheden <<endl;

count ++;
Vastgegevens.close();
}

"void" <chq@nie_spamuj.wp.pl> schreef in bericht
news:9178-1073909422@213.17.192.132...[color=blue]
> Użytkownik Kees Hoogendijk napisał, On 2004-01-12 12:10:
>[color=green]
> > Hi everyone,
> >
> > Actually I dont know how te explein this, that's why I paste my code[/color][/color]
below.[color=blue][color=green]
> > I've a main en I've a few header files. After I include the headers, the
> > compiler shows the errors as this exempel.
> >
> > Can someone tell me what is here going on?
> >
> > Tia
> >
> > Regard,
> >
> > Wen
> >
> >
> >
> > Exempel Error:
> >
> >
> >
> > C:\DOCUME~1\kees\LOCALS~1\Temp\ccCQaaaa.o(.text+0x 12f)
> >
> > [Warning] In function `main':
> >
> >
> >
> > [Linker error] undefined reference to `Verslag(std::basic_ofstream<char,
> > std::char_traits<char> >&, Constant&, Client&, ClientHistory&, int)'
> >[/color]
>
> Here You have declaration for Verslag function but I couldn't find
> implementation for this function. Maybe Yoo have it in your cpp file ??
> Is it compiled ?? Have You told your linker where is this compiled file ??
>
> Darek Ostolski
> --
> lint's little mind is blown.[/color]


void
Guest
 
Posts: n/a
#4: Jul 22 '05

re: undefined reference


Hello

Użytkownik Kees Hoogendijk napisał, On 2004-01-12 14:32:
[color=blue]
> Hallo Darek,
> In the Verslag.cpp I have also included the hpp as below. I dont understand
> hoe kan the compiler show error wiht " undefined ".
> Best Regards,
> Wen
>
>
> Verslag.cpp:
>
> #include "Verslag.hpp"
>
> void Verslag ( ofstream& verslag, Constant& ConstantRec, Client& MasterRec,
> ClientHistory& KlantHisRec, int klantNr)[/color]

I don't know what compiler do you use, in g++ it should work correctly:

g++ -c Verslag.cpp
g++ Verslag.o AEdi.cpp -o AEdi

Best Regards
Darek Ostolski
--
An unknown error has occurred in an unidentified program while
executing an unimplemented function at an undefined address.
Frank Schmitt
Guest
 
Posts: n/a
#5: Jul 22 '05

re: undefined reference


"Kees Hoogendijk" <nieuwskees@haalditweg-hcopleidingen.nl> writes:
[color=blue][color=green][color=darkred]
> > > [Linker error] undefined reference to `Verslag(std::basic_ofstream<char,
> > > std::char_traits<char> >&, Constant&, Client&, ClientHistory&, int)'[/color][/color][/color]
[color=blue]
> Hallo Darek,
> In the Verslag.cpp I have also included the hpp as below. I dont understand
> hoe kan the compiler show error wiht " undefined ".
> Best Regards,
> Wen
>
>
> Verslag.cpp:[/color]

Please don't top post - rearranged.
The linker can't find the definition for Verslag(...) - this usually means you
forgot to tell it to link Verslag.cpp into your executable.
Read your compiler documentation for instructions on how to do this.

HTH & kind regards
frank

--
Frank Schmitt
quattro research gmbh phone: +49 89 700763-0
e-mail: schmitt NO at SPAM quattro-research !@! dot com
Closed Thread