• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

使用 Code::Blocks 链接到库?

用户头像
it1352
帮助3

问题说明

C GUI 教程:对 TextOut 的未定义引用

我有同样的问题,但我是编程和 Code::Blocks 的新手,我想使用 GDI32 库.我该如何安装它?我很困惑,因为我可以使用 windows.h 标头,但是诸如 TextOut 之类的某些功能不可用.

I have the same problem, but I'm new to programming and Code::Blocks, and I want to use the GDI32 library. How can I install it? I'm very confused because I can use the windows.h header, but some functions like TextOut aren't available.

正确答案

#1

gdi32 库已经安装在您的计算机上,没有它,很少有程序可以运行.您的编译器(如果安装正确)通常会附带一个导入库,链接器使用它来在您的程序和系统中的文件之间进行绑定.(万一您的编译器没有为系统库提供导入库,您将需要下载 Microsoft Windows 平台 SDK.)

The gdi32 library is already installed on your computer, few programs will run without it. Your compiler will (if installed properly) normally come with an import library, which is what the linker uses to make a binding between your program and the file in the system. (In the unlikely case that your compiler does not come with import libraries for the system libs, you will need to download the Microsoft Windows Platform SDK.)

与 gdi32 链接:

To link with gdi32:

这将可靠地与 MinGW-gcc 一起用于所有系统库(如果您也使用任何其他编译器,它应该可以,但我不能谈论我没有尝试过的东西).你也可以写出库的全名,但是写libgdi32.agdi32 相比没有任何优势,除了更多类型的工作.
如果由于某种原因它不起作用,您可能需要提供一个不同的名称(例如,对于 MSVC,该库被命名为 gdi32.lib).

This will reliably work with MinGW-gcc for all system libraries (it should work if you use any other compiler too, but I can't talk about things I've not tried). You can also write the library's full name, but writing libgdi32.a has no advantage over gdi32 other than being more type work.
If it does not work for some reason, you may have to provide a different name (for example the library is named gdi32.lib for MSVC).

对于位于一些奇怪位置或项目子文件夹中的库,您需要提供正确的路径名(单击..."按钮打开文件选择对话框).

For libraries in some odd locations or project subfolders, you will need to provide a proper pathname (click on the "..." button for a file select dialog).

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tangicaij
系列文章
更多 icon
同类精品
更多 icon
继续加载