简体   繁体   English

未解析的外部符号(仍在发生)

[英]unresolved external symbol (still occurring)

When building my application in Debug mode: The build works. 在“调试”模式下构建应用程序时:构建有效。 The application works. 该应用程序正常工作。 When building my application in Release mode, I get the following error message 在发布模式下构建应用程序时,出现以下错误消息

error LNK2019: unresolved external symbol __imp__GetClassNameA@12 referenced in function _eachWindow@8

All implementation files of my application have a .c extension; 我的应用程序的所有实现文件都有一个.c扩展名。 that however doesn't mean I would know which compiler is used by visual studio. 但这并不意味着我会知道Visual Studio使用的是哪个编译器。

From the documentation of GetClassNameA I can see that a library User32.lib is required. 从GetClassNameA的文档中,我可以看到需要一个库User32.lib I have found a library with that name in 我在以下地方找到了一个同名图书馆

C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Lib> C:\\ Program Files \\ Microsoft SDKs \\ Windows \\ v7.1 \\ Lib>

I have added that directory to the property pages: 我已经将该目录添加到属性页:

Configuration Properties > Linker > General > Additional Library Directories 配置属性>链接器>常规>其他库目录

but that did not help. 但这没有帮助。 I am still receiving that error message. 我仍然收到该错误消息。

Thanks for help. 感谢帮助。 I know this question has been asked before, but the previous answers did not help me. 我知道之前曾有人问过这个问题,但是以前的答案对我没有帮助。 Please help in baby steps, I am still overwhelmed by Windows programming. 请帮忙,我仍然对Windows编程不知所措。

Does _eachWindow call GetClassName? _eachWindow是否调用GetClassName? Then you need to link user32.lib . 然后,您需要链接user32.lib Check the additional dependencies in the project's linker settings, not the additional library directories . 检查项目的链接器设置中的additional dependencies ,而不是additional library directories – dxiv – dxiv

dxiv's comment … makes the application work. dxiv的评论…使应用程序正常工作。 – chris j –克里斯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM