C ++ / CLI:链接器将显示"尚未解决的令牌QUOT;对于Win32函数令牌、函数、链接、CLI

2023-09-04 01:28:15 作者:wuli小仙女

伙计们,

我刚刚创建我的第一个C ++ / CLI项目(Visual Studio 2008中),这是一个图书馆,让我的C#应用​​程序访问销售理货打印机的一个点。

我的图书馆建立良好和琐碎的功能从C#的EXE调用时工作。

不过,只要我包括WinGDI调用( DeleteObject 的在这种情况下),所述连接体与抱怨悬而未决令牌的错误。

  

错误2错误LNK2028:无法解析   令牌(0A000088)外部的CINT   __stdcall DeleteObject(无效*)(?DeleteObject @@ $$ J14YGHPAX @ Z)   在功能上私引用:   __clrcall ReceiptPrinter ::爱普生::〜爱普生(无效)   (?? 1Epson @ ReceiptPrinter @@ $$ FA $ AAM @ XZ)ReceiptPrinter.obj ReceiptPrinter

我没有做任何认真的C ++在过去的4年,我有MS C ++编译器precious一点经验,因此我不知道我在寻找什么,在连接器设置。

任何帮助将greatfully接受。

感谢

解决方案   

其他的依赖关系是NOINHERIT,当我看着设置下的,有库的列表,gdi32.lib是在列表中。我查了从父项继承的项目,它现在的作品。德克,如果你添加所有,作为一个答案,我会选择它,并给你的代表。

检查Gdi32.lib是那里的链接器命令行(属性>链接>的CommandLine)。

(你去那里 - 你已经成功地吸引了灵魂的我的自私,代表追求的一部分;))

Folks,

I just created my first C++/CLI project (Visual Studio 2008), it's a Library to allow my C# app access an point of sale tally printer.

STM32使用FreeRTOS CLI

My library builds well and trivial functions work when called from a C# exe.

However as soon as I include a WinGDI call (DeleteObject in this case), the linker complains with "unresolved token" errors.

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

I haven't done any serious C++ in the last 4 years, and I have precious little experience of MS C++ compilers, as such I don’t know what I’m looking for in the linker settings.

Any help will be greatfully received.

Thanks

解决方案

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.

Check if Gdi32.lib is there in the linker commandline(Properties > Linker > CommandLine).

(There you go -- you have successfully appealed to the my selfish, rep seeking part of soul ;) )