Linker error Undefined Symbol

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vsen123
    New Member
    • Feb 2007
    • 2

    Linker error Undefined Symbol

    Hi,
    I wanted to use multiple source files for one program.I created a file "key.h" as follows:
    Code:
    #ifndef KEY_H
    #define KEY_H
    class Inputk
    {  int hkey[16][5];
    	char Kuser[64];
    	protected:
    	int Key[65];
    	public:
    	Inputk();
    	void read();
    	void displayhex();
    	~Inputk(){}
    };
    class Lookup1:public Inputk
    {  int Key_temp[57],PC1[9][8];
    	protected:
    	int c[29],d[29];
    	public:
    	Lookup1();
    	void displaycd();
    	void Lk_up_pc1();
    	~Lookup1(){}
    };
    class R_mov:public Lookup1
    {  int It[17],tempc,tempd,cnt;
    	protected:
    	int cn[17][29];
    	int dn[17][29];
    	public:
    	R_mov();
    	void Rot_l();
    	void Rot_display();
    	~R_mov(){}
    };
    class Finale:public R_mov
    {  int PC2[9][7],Key_t[57],t_cnt;
    	protected:
    	int Key_fin[][49];
    	public:
    	Finale();
    	void Lk_up_pc2();
    	void display();
    	void key_run();
    	~Finale(){}
    };
    #endif
    The associated cpp file key.cpp was created as follows:

    Code:
    #include "key.h"
    Inputk::Inputk()
    {  
      //Contents of constructor
    }
    void Inputk::read()
    { 
      //Contents of function read
    }
    void Inputk::displayhex()
    {
      //Contents of function displayhex
    }
    Lookup1::Lookup1()
    {  
      //Contents of constructor 
    }
    void Lookup1::Lk_up_pc1()
    { 
      //Contents of function Lk_up_pc1
    }
    void Lookup1::displaycd()
    { 
       //Contents of function displaycd
    }
    R_mov::R_mov()
    { 
      //Contents of constructor
    }
    void R_mov::Rot_l()
    {  
       //Contents of function Rot_l
    }
    void R_mov::Rot_display()
    {  
      //Contents of function Rot_display
    }
    Finale::Finale()
    {  
       //Contents of constructor
    }
    void Finale::Lk_up_pc2()
    { 
       //Contents of function Lk_up_pc2
    }
    void Finale::display()
    {  
        //Contents of function display
    }
    void Finale::key_run()
    {       clrscr();
    	read();
    	Lk_up_pc1();
    	Rot_l();
    	Lk_up_pc2();
    	display();
    }
    The header file "key.h" was called in another program "datconv.cp p" as:
    Code:
    #include<iostream.h>
    #include<fstream.h>
    #include<conio.h>
    #include<stdio.h>
    #include "key.h"
    
    class F_big:public Finale
    {  
       //Contents of class
    };
    ......
    //Function definations of F_big
    .......
    void main()
    {  F_big F;
       F.key_run();
       ....
    }
    The compiler didn't give any errors or warnings.Howeve r when I ran the program,I got 2 linker errors.
    "Undefined symbol Finale::Finale( ) in module DATCONV.CPP"
    "Undefined symbol Finale::key_run () in module DATCONV.CPP"
    Any suggestions?
  • MuraliCoder
    New Member
    • Oct 2006
    • 4

    #2
    Hi, in declaration of class "Finale"

    class Finale:public R_mov
    { int PC2[9][7],Key_t[57],t_cnt;
    protected:
    int Key_fin[][49];
    public:
    Finale();
    void Lk_up_pc2();
    void display();
    void key_run();
    ~Finale(){}
    };

    i guess u had not given the array size for int Key_fin[][49];
    give some value to this and try.. hope it will work...

    Comment

    Working...