DevC++ 链接器错误 [英] DevC++ Linker Errors

查看:24
本文介绍了DevC++ 链接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 devc++ 中的 win32 api 代码中收到以下错误:

I am receiving the following errors in my win32 api code in devc++:

[Linker error] undefined reference to `EnumProcessModules@16' 

[Linker error] undefined reference to `GetModuleFileNameExA@16'

ld returned 1 exit status 

我该如何解决这个问题?我尝试使用

How can I solve this problem? I tried using

#pragma comment(lib, "psapi.lib")

因为这是一个链接器问题,但它没有任何帮助.

since it was a linker issue but it did not help whatsoever.

推荐答案

链接提供缺失功能的库.

Link with the library that provides the missing functions.

如问题评论中所述,不幸的是,g++(很可能是您与 DevC++ 一起使用的编译器)不支持 #pragma comment.

As mentioned in the question comments, g++ (which most likely is the compiler that you’re using with DevC++) does unfortunately not support #pragma comment.

另外,正如问题评论中提到的,DevC++ 是一个相当过时和不好的 IDE.由于您使用的是 Windows,请尝试例如Code::Blocks 用于 g++ 编译器的 IDE,或 Microsoft 的 Visual C++ Express 用于 Visual C++ 的 IDE.对于后者,如果需要,您可以使用 #pragma

Also, as mentioned in the question comments, DevC++ is a rather outdated and ungood IDE. Since you are using Windows, try out e.g. Code::Blocks IDE for the g++ compiler, or Microsoft’s Visual C++ Express IDE for Visual C++. And with the latter you can use the #pragma, if you want…

这篇关于DevC++ 链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆