2011-10-28 24 views
0

我正在開發一個小型的可視化stdio 2010 C++項目。我創建了一個小型的基於Windows的項目。 GUI界面有一些按鈕。然後我用一些小函數創建了一個xxx.h和xxx.cpp文件。現在我想調用一個函數fom xxx,當有人按下按鈕時。我收到以下錯誤,請幫我....從其他職業的視覺工作室窗口調用功能

1>EagleTool.obj : error LNK2028: unresolved token (0A0000CF) "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" ([email protected]@@$$FSMXXZ) referenced in function "private: void __clrcall EagleGUI::Form1::button3_Click(class System::Object ^,class System::EventArgs ^)" ([email protected]@[email protected]@[email protected]@@[email protected]@@Z) 
1>EagleGUI.obj : error LNK2028: unresolved token (0A00000B) "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" ([email protected]@@$$FSMXXZ) referenced in function "private: void __clrcall EagleGUI::Form1::button3_Click(class System::Object ^,class System::EventArgs ^)" ([email protected]@[email protected]@[email protected]@@[email protected]@@Z) 
1>EagleGUI.obj : error LNK2019: unresolved external symbol "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" ([email protected]@@$$FSMXXZ) referenced in function "private: void __clrcall EagleGUI::Form1::button3_Click(class System::Object ^,class System::EventArgs ^)" ([email protected]@[email protected]@[email protected]@@[email protected]@@Z) 
1>EagleTool.obj : error LNK2001: unresolved external symbol "public: static void __clrcall EagleTool::extractCorrectPathofEagle(void)" ([email protected]@@$$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(){ 

} 
+0

EagleTool是託管類嗎?您是否編寫了extractCorrectPathofEagle()函數的代碼? –

+0

我想看一些代碼。目前還不清楚您是否是混合模式編程,以及是否鏈接相關對象,在需要時指定/ clr等。 – sehe

回答

1

您需要包括在定義中的類名:

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

否則你是definin g一個完全不相關的函數,恰好有相同的名稱。