Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > undefined reference

Reply
Thread Tools

undefined reference

 
 
Kees Hoogendijk
Guest
Posts: n/a
 
      01-12-2004
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




 
Reply With Quote
 
 
 
 
void
Guest
Posts: n/a
 
      01-12-2004
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+0x 12f)
>
> [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
--
lint's little mind is blown.
 
Reply With Quote
 
 
 
 
Kees Hoogendijk
Guest
Posts: n/a
 
      01-12-2004
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( << 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...
> 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+0x 12f)
> >
> > [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
> --
> lint's little mind is blown.



 
Reply With Quote
 
void
Guest
Posts: n/a
 
      01-12-2004
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
--
An unknown error has occurred in an unidentified program while
executing an unimplemented function at an undefined address.
 
Reply With Quote
 
Frank Schmitt
Guest
Posts: n/a
 
      01-14-2004
"Kees Hoogendijk" <(E-Mail Removed)> writes:

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

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

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
typeof x == 'undefined' or x == undefined? -Lost Javascript 13 01-31-2007 12:04 AM
undefined vs. undefined (was: new Array() vs []) VK Javascript 45 09-12-2006 05:26 PM
'Undefined' Client-Side Object Reference Felipe ASP .Net 3 07-16-2004 04:01 AM
undefined behavior or not undefined behavior? That is the question Mantorok Redgormor C Programming 70 02-17-2004 02:46 PM
Error: 'undefined reference' in g++ but gcc succeeded Lu C++ 1 07-10-2003 12:55 PM



Advertisments