【发布时间】:2012-09-14 19:24:37
【问题描述】:
我在尝试构建 C++/CLI dll 时遇到 LNK2028 错误。我在我的程序中使用了一个名为 pano13 的静态库,并且我正在使用它的一种方法。我的程序中的一切都很好,除了我对库进行的一个方法调用,在那里我得到了这两个确切的例外。
Error 21 error LNK2028: unresolved token (0A00013B) "int __cdecl panoCreatePanorama(struct fullPath * const,int,struct fullPath *,struct fullPath *)" (?panoCreatePanorama@@$$FYAHQAUfullPath@@HPAU1@1@Z) referenced in function "public: int __clrcall Surgeon::Stitcher::StitchImage(class System::Collections::Generic::List<class System::String ^> ^,class System::String ^)" (?StitchImage@Stitcher@Surgeon@@$$FQ$AAMHP$AAV?$List@P$AAVString@System@@@Generic@Collections@System@@P$AAVString@6@@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 *)" (?panoCreatePanorama@@$$FYAHQAUfullPath@@HPAU1@1@Z) referenced in function "public: int __clrcall Surgeon::Stitcher::StitchImage(class System::Collections::Generic::List<class System::String ^> ^,class System::String ^)" (?StitchImage@Stitcher@Surgeon@@$$FQ$AAMHP$AAV?$List@P$AAVString@System@@@Generic@Collections@System@@P$AAVString@6@@Z) C:\Users\ndean_000\Documents\Visual Studio 2012\Projects\C#\CameraTest\Surgeon\Surgeon.obj Surgeon
我在项目设置中包含了 lib 文件,我什至添加了 #pragma 注释语句来包含该库,但是我收到了这个错误。我知道它与本机和托管 C++ 的混合有关,但是我没有使用 clr/pure 编译程序,而是使用 /clr 的默认 clr 编译进行编译。有人知道如何解决它吗?
【问题讨论】:
-
你从托管调用非托管????
-
是的,据我所知和所见,我应该能够在未使用 /clr:pure 编译的 C++/CLI dll 中执行此操作。
-
你是从 C# 代码中调用的吗????
-
我正在使用 C++ 进行此调用。对 panoCreatePanorama 的调用是 C++/CLI dll 文件中的 C++ 调用。
-
不太熟悉 C++/CLI 但这可能会有所帮助 voyce.com/index.php/2007/05/11/…