如何使用/链接gdLibrary(libgd)与MS Visual C + +(例如2008速成版)?获取LNK2019错误 [英] How to use/link gdLibrary (libgd) with MS Visual C++ (e.g. 2008 Express Edition)? Getting LNK2019 errors

查看:380
本文介绍了如何使用/链接gdLibrary(libgd)与MS Visual C + +(例如2008速成版)?获取LNK2019错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用gdLibrary(http://www.libgd.org)在MS Windows XP教授SP3 32位的C + +应用程序 - 我试图和googleing两天,现在没有成功。有没有人使用libgd与MS VC ++ 200x EE?

I have to use the gdLibrary (http://www.libgd.org) in a C++ App on MS Windows XP Prof. SP3 32bit - and I'm trying and googleing for two days now without success. Does anyone of you use libgd with MS VC++ 200x EE?

我的问题:必须使用MS Visual C ++编译(例如2008 Express Edition - 固定的第三方条件)...但是当前链接器崩溃,其中11个 LNK2019 错误:

My problem: It has to to compile with MS Visual C++ (e.g. the 2008 Express Edition - fixed 3rd party condition)... but currently the linker crashes, with 11 of the following LNK2019 errors:


链接...
codereate.obj:error LNK2019:在public:virtual __thiscall CodeCreate ::〜CodeCreate(void)中找到未定义的外部符号_gdImageDestroy

Linking... codereate.obj : error LNK2019: An undefined external symbol "_gdImageDestroy" was found in "public: virtual __thiscall CodeCreate::~CodeCreate(void)"

其他的smybols是 _gdImageColorExact _gdImageCopyResized 和一些其他gd函数。看来,VC ++链接器不能正确工作与从 http://www.libgd.org下载的软件包提供的 bgd.lib /releases/gd-latest-win32.zip

The other smybols are _gdImageColorExact, _gdImageCopyResized and some other gd-functions. It seems that the VC++ linker does not work correctly with the bgd.lib provided by the package I downloaded from http://www.libgd.org/releases/gd-latest-win32.zip.

我所做的/尝试过的


  1. 提取 gd-latest-win32.zip c:\users\johndoe\cpp\libgd

  2. 定义 c:\users\johndoe\cpp\libgd\lib als附加库目录)

  3. 定义 c:\users\johndoe\cpp\libgd\设置)

  4. 定义 c:\users\johndoe\cpp\libgd\include\lib\bgd.lib 作为附加链接器\input依赖项(项目设置)

  5. 我甚至添加了 #pragma comment(lib,libgd.lib)
  1. Extracted gd-latest-win32.zip to c:\users\johndoe\cpp\libgd.
  2. Defined c:\users\johndoe\cpp\libgd\lib als additional library dir (global VC++ setting)
  3. Defined c:\users\johndoe\cpp\libgd\include as additional includes dir (global VC++ setting)
  4. Defined c:\users\johndoe\cpp\libgd\include\lib\bgd.lib as additional linker\input dependency (project setting)
  5. I even added #pragma comment(lib, "libgd.lib") into my codecreate.h to be on the save side.

有什么建议么?我做错了什么(例如,我忘了安装东西)?是否有任何欺骗获得VC ++ 2008兼容 bgd.lib

Any suggestions? What am I doing wrong (e.g. have I forget to install something)? Is there any "trick" to get a VC++ 2008 compatible bgd.lib?


  1. 在Linux / g ++上运行,一切正常,没有警告 -pedantic -ansi - wAll

  2. 对于Win32使用DevC ++ 时,它可以正常工作。因此它不是Windows的问题,只是一个VC ++问题。对于DevC ++我做了:

    • 我刚刚下载了 http://www.libgd.org/releases/gd-latest-win32.zip

    • 解压缩到 c:\users\johndoe\cpp\libgd

    • 添加了 c:\users\johndoe\cpp\libgd\lib\bgd.lib 作为链接器中的附加对象 - 项目设置。

    • 定义 c:\users\johndoe\cpp\libgd\lib

    • 定义 c:\users\johndoe\cpp\libgd\包含
    • 对一些条形码东西很满意

  1. Running on Linux/g++, everything works fine, no warnings with -pedantic -ansi -wAll. The program does its job an generates some barcodes.
  2. It works when using DevC++ for Win32. Therefore it is no Windows issue, "just" a VC++ issue. For DevC++ I did:
    • I just downloaded http://www.libgd.org/releases/gd-latest-win32.zip,
    • extracted it to c:\users\johndoe\cpp\libgd
    • added c:\users\johndoe\cpp\libgd\lib\bgd.lib as additional obbject in the linker-projects settings.
    • defined c:\users\johndoe\cpp\libgd\lib als additional library dir,
    • defined c:\users\johndoe\cpp\libgd\include as additional includes dir
    • happy about some barcode stuff


推荐答案

你的项目?如果你这样做,你应该使用bgd_a.lib。还需要确保你已经定义了WIN32

Did you put NODLL definition in your project? If you did that, you should use bgd_a.lib instead. And you also need to make sure you have defined WIN32.

我试图创建一个简单的项目与最新版本,它确实链接成功。如果我添加NODLL而不改变tot bgd_a,那么我得到相同的错误消息。

I tried to create a simple project with latest release and it does linked success. If I add NODLL without changing tot bgd_a then I get the same error message.

这篇关于如何使用/链接gdLibrary(libgd)与MS Visual C + +(例如2008速成版)?获取LNK2019错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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