Error LNK 2019 problem
-
Hi fellows I'm using Visual C++ 2005 Express Edition and I'm getting some errors when I execute my app. This is my class that I defined in a ".h" file called "FloatText.h":
#ifndef FLOATTEXT_H #define FLOATTEXT_H class FloatText { public: FloatText(); ~FloatText(); void SetText(char * cText); void MoveText(int iXPos, int iYPos); char * GetText(); private: float m_XPos, m_YPos, m_ZPos; double m_fModelviewMatrix[16]; double m_fProjectionMatrix[16]; int m_iViewportMatrix[4]; static int m_iTextObjects; char * m_cString; int m_iStringPos; }; #endif FLOATTEXT_H
I implemented this class in a ".cpp" file, and include the "FloatText.h" in the "main.cpp" too. No problems until now. When I press CTRL+F5 these errors are shown to me:main.obj : error LNK2019: unresolved external symbol "public: char * __thiscall FloatText::GetText(void)" (?GetText@FloatText@@QAEPADXZ) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: void __thiscall FloatText::MoveText(int,int)" (?MoveText@FloatText@@QAEXHH@Z) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: __thiscall FloatText::FloatText(void)" (??0FloatText@@QAE@XZ) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: void __thiscall FloatText::SetText(char *)" (?SetText@FloatText@@QAEXPAD@Z) referenced in function "long __stdcall WindowProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z)
So, what's going on if the code compilation runs normally??? thanks -
Hi fellows I'm using Visual C++ 2005 Express Edition and I'm getting some errors when I execute my app. This is my class that I defined in a ".h" file called "FloatText.h":
#ifndef FLOATTEXT_H #define FLOATTEXT_H class FloatText { public: FloatText(); ~FloatText(); void SetText(char * cText); void MoveText(int iXPos, int iYPos); char * GetText(); private: float m_XPos, m_YPos, m_ZPos; double m_fModelviewMatrix[16]; double m_fProjectionMatrix[16]; int m_iViewportMatrix[4]; static int m_iTextObjects; char * m_cString; int m_iStringPos; }; #endif FLOATTEXT_H
I implemented this class in a ".cpp" file, and include the "FloatText.h" in the "main.cpp" too. No problems until now. When I press CTRL+F5 these errors are shown to me:main.obj : error LNK2019: unresolved external symbol "public: char * __thiscall FloatText::GetText(void)" (?GetText@FloatText@@QAEPADXZ) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: void __thiscall FloatText::MoveText(int,int)" (?MoveText@FloatText@@QAEXHH@Z) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: __thiscall FloatText::FloatText(void)" (??0FloatText@@QAE@XZ) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: void __thiscall FloatText::SetText(char *)" (?SetText@FloatText@@QAEXPAD@Z) referenced in function "long __stdcall WindowProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z)
So, what's going on if the code compilation runs normally??? thanksthe error came because you might havent implement the following functions GetText MoveText FloatText SetText in the cpp file or the way u implement wasnt correct. Check whether you have implemented the fu nction as shown below eg:
char* **FloatText**::GetText() { return ......; }
nave
-
Hi fellows I'm using Visual C++ 2005 Express Edition and I'm getting some errors when I execute my app. This is my class that I defined in a ".h" file called "FloatText.h":
#ifndef FLOATTEXT_H #define FLOATTEXT_H class FloatText { public: FloatText(); ~FloatText(); void SetText(char * cText); void MoveText(int iXPos, int iYPos); char * GetText(); private: float m_XPos, m_YPos, m_ZPos; double m_fModelviewMatrix[16]; double m_fProjectionMatrix[16]; int m_iViewportMatrix[4]; static int m_iTextObjects; char * m_cString; int m_iStringPos; }; #endif FLOATTEXT_H
I implemented this class in a ".cpp" file, and include the "FloatText.h" in the "main.cpp" too. No problems until now. When I press CTRL+F5 these errors are shown to me:main.obj : error LNK2019: unresolved external symbol "public: char * __thiscall FloatText::GetText(void)" (?GetText@FloatText@@QAEPADXZ) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: void __thiscall FloatText::MoveText(int,int)" (?MoveText@FloatText@@QAEXHH@Z) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: __thiscall FloatText::FloatText(void)" (??0FloatText@@QAE@XZ) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: void __thiscall FloatText::SetText(char *)" (?SetText@FloatText@@QAEXPAD@Z) referenced in function "long __stdcall WindowProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z)
So, what's going on if the code compilation runs normally??? thanksAlex Cutovoi wrote:
I implemented this class in
a ".cpp" file
Where is this cpp file. Is it included in the project.
Nibu thomas A Developer Programming tips[^] My site[^]
-
Hi fellows I'm using Visual C++ 2005 Express Edition and I'm getting some errors when I execute my app. This is my class that I defined in a ".h" file called "FloatText.h":
#ifndef FLOATTEXT_H #define FLOATTEXT_H class FloatText { public: FloatText(); ~FloatText(); void SetText(char * cText); void MoveText(int iXPos, int iYPos); char * GetText(); private: float m_XPos, m_YPos, m_ZPos; double m_fModelviewMatrix[16]; double m_fProjectionMatrix[16]; int m_iViewportMatrix[4]; static int m_iTextObjects; char * m_cString; int m_iStringPos; }; #endif FLOATTEXT_H
I implemented this class in a ".cpp" file, and include the "FloatText.h" in the "main.cpp" too. No problems until now. When I press CTRL+F5 these errors are shown to me:main.obj : error LNK2019: unresolved external symbol "public: char * __thiscall FloatText::GetText(void)" (?GetText@FloatText@@QAEPADXZ) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: void __thiscall FloatText::MoveText(int,int)" (?MoveText@FloatText@@QAEXHH@Z) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: __thiscall FloatText::FloatText(void)" (??0FloatText@@QAE@XZ) referenced in function _WinMain@16 main.obj : error LNK2019: unresolved external symbol "public: void __thiscall FloatText::SetText(char *)" (?SetText@FloatText@@QAEXPAD@Z) referenced in function "long __stdcall WindowProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z)
So, what's going on if the code compilation runs normally??? thanksDid you declare body for functions on the FloatText.cpp
WhiteSky
-
Did you declare body for functions on the FloatText.cpp
WhiteSky
Problem solved guys, I include the files in my project with the option, right clicking in my project and selecting "Add Existing Item". And works fine. thanks for the support
-
Problem solved guys, I include the files in my project with the option, right clicking in my project and selecting "Add Existing Item". And works fine. thanks for the support
I glad you find it:-D
WhiteSky