lankabeta
lankabeta

Reputation: 91

visual studio windows calling function from other class

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(){

}

Upvotes: 0

Views: 2686

Answers (1)

Ernest Friedman-Hill
Ernest Friedman-Hill

Reputation: 81674

You need to include the class name in the definition:

static void EagleTool::extractCorrectPathofEagle() {
    // ...
}

Otherwise you're defining an entirely unrelated function that just happens to have the same name.

Upvotes: 1

Related Questions