What's wrong?Please help!
No compile error but I got this linking errors :-
Code:Compiling... main.cpp Linking... Test_Display.obj : error LNK2001: unresolved external symbol "public: void __thiscall Test_Text::test_put_text(char *)" (?test_put_text@Test_Text@@QAEXPAD@Z) Test_Display.obj : error LNK2001: unresolved external symbol "public: void __thiscall Test_Display::test_put_display(char *)" (?test_put_display@Test_Display@@QAEXPAD@Z) Test_Display.obj : error LNK2001: unresolved external symbol "public: void __thiscall Test_Indicator::test_put_indicator(char *)" (?test_put_indicator@Test_Indicator@@QAEXPAD@Z) Debug/H1.exe : fatal error LNK1120: 3 unresolved externals Error executing link.exe. H1.exe - 4 error(s), 0 warning(s)
Here are the .cpp and .h files:-
Code:1) Test_Display.h #ifndef TEST_DISPLAY_H #define TEST_DISPLAY_H #include "Sum_Class.h" class TestDisplay { public: TestDisplay(); TestDisplay(int); void put_text (char *text); void put_indicator (char *text); void put_display (char *text); private: Test_Indicator* m_ptr_ind; Test_Text* m_ptr_text; Test_Display* m_ptr_display; }; #endif TEST_DISPLAY_H
Code:2) Test_Display.cpp #include <iostream.h> #include "Test_Display.h" #include "Sum_Class.h" TestDisplay::TestDisplay (int displayType) { m_ptr_ind = new Test_Indicator(displayType); m_ptr_text = new Test_Text(displayType); m_ptr_display = new Test_Display(displayType); } void TestDisplay::put_text (char *text) { m_ptr_text->test_put_text(text); } void TestDisplay::put_display (char *text) { m_ptr_display->test_put_display(text); } void TestDisplay::put_indicator (char *text) { m_ptr_ind->test_put_indicator(text); }
Code:3) Sum_Class.h #ifndef SUM_CLASS_H #define SUM_CLASS_H class Test_Text { public: Test_Text(int x) {display_id = x;} void test_put_text(char *str); private: int display_id; }; class Test_Display { public: Test_Display(int x) {display_id = x;} void test_put_display(char *str); private: int display_id; }; class Test_Indicator { public: Test_Indicator(int x) { display_id = x;} void test_put_indicator(char *str); private: int display_id; }; #endif // SUM_CLASS_H
Code:4) main.cpp #include <iostream.h> #include "Test_Display.h" #define TOP 0 #define FRONT 1 void main(void) { TestDisplay *TestArr[2]; TestArr[TOP] = new TestDisplay(TOP); TestArr[FRONT] = new TestDisplay(FRONT); }



LinkBack URL
About LinkBacks



