Visual Studio Windows 从其他类调用函数
我正在开发一个小型的 Visual stdio 2010 C++ 项目。我创建了一个基于 Windows 的小型项目。 GUI界面有一些按钮。然后我创建了一个 xxx.h 和 xxx.cpp 文件,其中包含一些小函数。现在我想在有人按下按钮时调用 xxx 的函数。我收到以下错误请帮助我......
1>EagleTool.obj : error LNK2028: unresolved token (0A0000CF) "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" (?extractCorrectPathofEagle@EagleTool@@$$FSMXXZ) referenced in function "private: void __clrcall EagleGUI::Form1::button3_Click(class System::Object ^,class System::EventArgs ^)" (?button3_Click@Form1@EagleGUI@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>EagleGUI.obj : error LNK2028: unresolved token (0A00000B) "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" (?extractCorrectPathofEagle@EagleTool@@$$FSMXXZ) referenced in function "private: void __clrcall EagleGUI::Form1::button3_Click(class System::Object ^,class System::EventArgs ^)" (?button3_Click@Form1@EagleGUI@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>EagleGUI.obj : error LNK2019: unresolved external symbol "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" (?extractCorrectPathofEagle@EagleTool@@$$FSMXXZ) referenced in function "private: void __clrcall EagleGUI::Form1::button3_Click(class System::Object ^,class System::EventArgs ^)" (?button3_Click@Form1@EagleGUI@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>EagleTool.obj : error LNK2001: unresolved external symbol "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" (?extractCorrectPathofEagle@EagleTool@@$$FSMXXZ)
EagleTool.h
#ifndef _EagleTool_H_
#define _EagleTool_H_
class EagleTool {
public:
void static extractCorrectPathofEagle();
};
#endif
EagleTool.cpp
#include "stdafx.h"
#include "EagleTool.h"
#include "Form1.h"
void static extractCorrectPathofEagle(){
}
I am developing a small visual stdio 2010 c++ project. I have created a small windows based project. The GUI interface have some buttons. Then I have created a xxx.h and xxx.cpp file with some small function. Now I want to call a function fom xxx, when some one press the button. I am getting following error please help me....
1>EagleTool.obj : error LNK2028: unresolved token (0A0000CF) "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" (?extractCorrectPathofEagle@EagleTool@@$FSMXXZ) referenced in function "private: void __clrcall EagleGUI::Form1::button3_Click(class System::Object ^,class System::EventArgs ^)" (?button3_Click@Form1@EagleGUI@@$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>EagleGUI.obj : error LNK2028: unresolved token (0A00000B) "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" (?extractCorrectPathofEagle@EagleTool@@$FSMXXZ) referenced in function "private: void __clrcall EagleGUI::Form1::button3_Click(class System::Object ^,class System::EventArgs ^)" (?button3_Click@Form1@EagleGUI@@$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>EagleGUI.obj : error LNK2019: unresolved external symbol "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" (?extractCorrectPathofEagle@EagleTool@@$FSMXXZ) referenced in function "private: void __clrcall EagleGUI::Form1::button3_Click(class System::Object ^,class System::EventArgs ^)" (?button3_Click@Form1@EagleGUI@@$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>EagleTool.obj : error LNK2001: unresolved external symbol "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" (?extractCorrectPathofEagle@EagleTool@@$FSMXXZ)
EagleTool.h
#ifndef _EagleTool_H_
#define _EagleTool_H_
class EagleTool {
public:
void static extractCorrectPathofEagle();
};
#endif
EagleTool.cpp
#include "stdafx.h"
#include "EagleTool.h"
#include "Form1.h"
void static extractCorrectPathofEagle(){
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在定义中包含类名:
否则您将定义一个完全不相关的函数,而该函数恰好具有相同的名称。
You need to include the class name in the definition:
Otherwise you're defining an entirely unrelated function that just happens to have the same name.