By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,413 Members | 1,017 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,413 IT Pros & Developers. It's quick & easy.

Linker error Undefined Symbol

P: 2
Hi,
I wanted to use multiple source files for one program.I created a file "key.h" as follows:
Expand|Select|Wrap|Line Numbers
  1. #ifndef KEY_H
  2. #define KEY_H
  3. class Inputk
  4. {  int hkey[16][5];
  5.     char Kuser[64];
  6.     protected:
  7.     int Key[65];
  8.     public:
  9.     Inputk();
  10.     void read();
  11.     void displayhex();
  12.     ~Inputk(){}
  13. };
  14. class Lookup1:public Inputk
  15. {  int Key_temp[57],PC1[9][8];
  16.     protected:
  17.     int c[29],d[29];
  18.     public:
  19.     Lookup1();
  20.     void displaycd();
  21.     void Lk_up_pc1();
  22.     ~Lookup1(){}
  23. };
  24. class R_mov:public Lookup1
  25. {  int It[17],tempc,tempd,cnt;
  26.     protected:
  27.     int cn[17][29];
  28.     int dn[17][29];
  29.     public:
  30.     R_mov();
  31.     void Rot_l();
  32.     void Rot_display();
  33.     ~R_mov(){}
  34. };
  35. class Finale:public R_mov
  36. {  int PC2[9][7],Key_t[57],t_cnt;
  37.     protected:
  38.     int Key_fin[][49];
  39.     public:
  40.     Finale();
  41.     void Lk_up_pc2();
  42.     void display();
  43.     void key_run();
  44.     ~Finale(){}
  45. };
  46. #endif
  47.  
The associated cpp file key.cpp was created as follows:

Expand|Select|Wrap|Line Numbers
  1. #include "key.h"
  2. Inputk::Inputk()
  3. {  
  4.   //Contents of constructor
  5. }
  6. void Inputk::read()
  7.   //Contents of function read
  8. }
  9. void Inputk::displayhex()
  10. {
  11.   //Contents of function displayhex
  12. }
  13. Lookup1::Lookup1()
  14. {  
  15.   //Contents of constructor 
  16. }
  17. void Lookup1::Lk_up_pc1()
  18.   //Contents of function Lk_up_pc1
  19. }
  20. void Lookup1::displaycd()
  21.    //Contents of function displaycd
  22. }
  23. R_mov::R_mov()
  24.   //Contents of constructor
  25. }
  26. void R_mov::Rot_l()
  27. {  
  28.    //Contents of function Rot_l
  29. }
  30. void R_mov::Rot_display()
  31. {  
  32.   //Contents of function Rot_display
  33. }
  34. Finale::Finale()
  35. {  
  36.    //Contents of constructor
  37. }
  38. void Finale::Lk_up_pc2()
  39.    //Contents of function Lk_up_pc2
  40. }
  41. void Finale::display()
  42. {  
  43.     //Contents of function display
  44. }
  45. void Finale::key_run()
  46. {       clrscr();
  47.     read();
  48.     Lk_up_pc1();
  49.     Rot_l();
  50.     Lk_up_pc2();
  51.     display();
  52. }
  53.  
The header file "key.h" was called in another program "datconv.cpp" as:
Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<fstream.h>
  3. #include<conio.h>
  4. #include<stdio.h>
  5. #include "key.h"
  6.  
  7. class F_big:public Finale
  8. {  
  9.    //Contents of class
  10. };
  11. ......
  12. //Function definations of F_big
  13. .......
  14. void main()
  15. {  F_big F;
  16.    F.key_run();
  17.    ....
  18. }
  19.  
The compiler didn't give any errors or warnings.However 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?
Feb 20 '07 #1
Share this Question
Share on Google+
1 Reply


P: 4
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...
Feb 20 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.