undefined reference

Discussion in 'C++' started by Kees Hoogendijk, Jan 12, 2004.

  1. 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
    Kees Hoogendijk, Jan 12, 2004
    #1
    1. Advertising

  2. Kees Hoogendijk

    void Guest

    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
    --
    lint's little mind is blown.
    void, Jan 12, 2004
    #2
    1. Advertising

  3. 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...
    > 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
    > --
    > lint's little mind is blown.
    Kees Hoogendijk, Jan 12, 2004
    #3
  4. Kees Hoogendijk

    void Guest

    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.
    void, Jan 12, 2004
    #4
  5. "Kees Hoogendijk" <> 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
    Frank Schmitt, Jan 14, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Felipe
    Replies:
    3
    Views:
    438
    Felipe
    Jul 16, 2004
  2. Lu
    Replies:
    1
    Views:
    560
    Roel Schroeven
    Jul 10, 2003
  3. Mantorok Redgormor
    Replies:
    70
    Views:
    1,731
    Dan Pop
    Feb 17, 2004
  4. VK
    Replies:
    45
    Views:
    578
    Dr John Stockton
    Sep 12, 2006
  5. -Lost
    Replies:
    13
    Views:
    358
    Richard Cornford
    Jan 31, 2007
Loading...

Share This Page