2012-09-14 45 views
0

當我嘗試構建我的C++/CLI dll時,出現LNK2028錯誤。我在我的程序中使用了一個名爲pano13的靜態庫,我正在使用它的一種方法。我的程序中的所有內容都很好,除了我給庫所做的一個方法調用,我在這裏得到了這兩個確切的例外。當試圖使用另一個庫的靜態lib時C++/CLI LNK2028

Error 21 error LNK2028: unresolved token (0A00013B) "int __cdecl panoCreatePanorama(struct fullPath * const,int,struct fullPath *,struct fullPath *)" ([email protected]@[email protected]@[email protected]@Z) referenced in function "public: int __clrcall Surgeon::Stitcher::StitchImage(class System::Collections::Generic::List<class System::String ^> ^,class System::String ^)" ([email protected]@[email protected]@[email protected][email protected]@@@[email protected]@[email protected]@[email protected]@@Z) C:\Users\ndean_000\Documents\Visual Studio 2012\Projects\C#\CameraTest\Surgeon\Surgeon.obj Surgeon 

Error 22 error LNK2019: unresolved external symbol "int __cdecl panoCreatePanorama(struct fullPath * const,int,struct fullPath *,struct fullPath *)" ([email protected]@[email protected]@[email protected]@Z) referenced in function "public: int __clrcall Surgeon::Stitcher::StitchImage(class System::Collections::Generic::List<class System::String ^> ^,class System::String ^)" ([email protected]@[email protected]@[email protected][email protected]@@@[email protected]@[email protected]@[email protected]@@Z) C:\Users\ndean_000\Documents\Visual Studio 2012\Projects\C#\CameraTest\Surgeon\Surgeon.obj Surgeon 

我包括在項目設置的lib文件,我甚至增加使用#pragma註釋語句包括圖書館,但是我得到這個錯誤。我知道它與混合本機和託管C++有關,但是我不用clr/pure編譯程序,它正在使用/ clr的默認clr編譯進行編譯。任何人有任何想法如何解決它?

+0

您正在調用託管的非託管???? – user1655481

+0

是的,我應該可以在C++/CLI dll中完成這個工作,它不是用/ clr:pure編譯的,據我所知和所見。 –

+0

,你是否從C#代碼中調用這個函數? – user1655481

回答

0

順便說一下,我在WHILE之前解決了這個問題,但我應該說出問題所在。 panotools庫是一個C庫,而不是C++庫。我不知道C庫需要在C++中使用extern C指令。所以我需要做的只是修復我的問題

extern "C" 
{ 
    #include <panorama.h> 
} 

其中,panorama.h是panotools C庫的包含文件。我一直想知道C是什麼,現在我終於明白了它的目的。

相關問題