undefined reference

K

Kees Hoogendijk

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+0x12f)

[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
 
V

void

U¿ytkownik Kees Hoogendijk napisa³, On 2004-01-12 12:10:
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+0x12f)

[Warning] In function `main':



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

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
 
K

Kees Hoogendijk

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 said:
U¿ytkownik Kees Hoogendijk napisa³, On 2004-01-12 12:10:
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+0x12f)

[Warning] In function `main':



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

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
 
V

void

Hello

U¿ytkownik Kees Hoogendijk napisa³, On 2004-01-12 14:32:
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)

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
 
F

Frank Schmitt

Kees Hoogendijk said:
[Linker error] undefined reference to `Verslag(std::basic_ofstream<char,
std::char_traits<char> >&, Constant&, Client&, ClientHistory&, int)'
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:

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top