.net - C++/命令行界面 : linker gives "unresolved token" for win32 function

标签 .net visual-studio c++-cli

各位,

我刚刚创建了我的第一个 C++/CLI 项目 (Visual Studio 2008),它是一个允许我的 C# 应用程序访问销售点理货打印机的库。

我的库构建良好,从 C# exe 调用时,一些简单的函数也能正常工作。

然而,一旦我包含一个 WinGDI 调用(在本例中为 DeleteObject),链接器就会提示“未解析的 token ”错误。

Error 2 error LNK2028: unresolved token (0A000088) "extern "C" int __stdcall DeleteObject(void *)" (?DeleteObject@@$$J14YGHPAX@Z) referenced in function "private: __clrcall ReceiptPrinter::Epson::~Epson(void)" (??1Epson@ReceiptPrinter@@$$FA$AAM@XZ) ReceiptPrinter.obj ReceiptPrinter

在过去的 4 年里,我没有真正使用过 C++,而且我对 MS C++ 编译器的经验也很少,因此我不知道我在链接器设置中寻找什么。

我们将不胜感激任何帮助。

谢谢

最佳答案

Additional dependancies was "NoInherit", when I looked "under" the setting, there was a list of libs, gdi32.lib was in the list. I checked "Inherit from parent project" and it now works. Dirk, if you add all that as an answer I'll select it and give you the rep.

检查链接器命令行中是否存在 Gdi32.lib(属性 > 链接器 > 命令行)。

(好了——你已经成功地吸引了我自私的、寻求代表的灵魂部分;))

关于.net - C++/命令行界面 : linker gives "unresolved token" for win32 function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/739952/

相关文章:

.net - 如何让 DispatcherTimer 设置一个超过 24 天的计时器?

c# - 如何在 StreamReader 或 String 中搜索 HTML 元素

.net - MVC HTML Helper 自定义命名空间

c++ - CLR中 native 堆的内存管理

c# - 从 C++ 库调用 C++/CLI 函数

c# - 单个 x86 构建的程序集导致整个程序集作为 32 位执行

asp.net - NuGet 命令行已停止工作

c++ - Visual Studio - 程序在分析时运行得更快

asp.net - Visual Studio 2003生产力提示

c++-cli - 使用 Predicate 和 Array::FindAll() 编译 C++/CLI 委托(delegate)调用时出错