微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将Andy Sloane的texturesynth与gnuwin32的gd for Windows链接时,链接未检测到外部符号

如何解决将Andy Sloane的texturesynth与gnuwin32的gd for Windows链接时,链接未检测到外部符号

我正在尝试使用Andy Sloane's TextureSynth在Windows中编译GnuWin32's gd for windows,我成功地编译了gen.cpp和img.cpp,但是当尝试将obj文件与libgd.lib链接时,Microsoft的链接随地吐痰出现以下错误

img.obj : error LNK2019: external symbol _gdImageCreateTrueColor without resolving referenced in the function "public: bool __thiscall Img::save_png(char const *)" (?save_png@Img@@QAE_NPBD@Z)
img.obj : error LNK2019: external symbol _gdimagecreatefrompng without resolving referenced in the function "public: static class Img * __cdecl Img::load_png(char const *)" (?load_png@Img@@SAPAV1@PBD@Z)
img.obj : error LNK2019: external symbol _gdImageDestroy without resolving referenced in the function "public: static class Img * __cdecl Img::load_png(char const *)" (?load_png@Img@@SAPAV1@PBD@Z)
img.obj : error LNK2019: external symbol _gdimagesetPixel sin resolver al que se hace referencia en la función "public: bool __thiscall Img::save_png(char const *)" (?save_png@Img@@QAE_NPBD@Z)
img.obj : error LNK2019: external symbol _gdImageGetPixel without resolving referenced in the function  "public: static class Img * __cdecl Img::load_png(char const *)" (?load_png@Img@@SAPAV1@PBD@Z)
img.obj : error LNK2019: external symbol _gdImagePng without resolving referenced in the function "public: bool __thiscall Img::save_png(char const *)" (?save_png@Img@@QAE_NPBD@Z)
gen.exe : Fatal error LNK1120: 6 unresolved external symbols

修改了img.cpp的第一行,现在他们说:

#define BGDWIN32
#include <stdlib.h>
#include <stdio.h>
#include "inc\gd.h"
#include "img.h"

命令是:

cl /c img.cpp
cl /c gen.cpp
link gen.obj img.obj .\lib\libgd.lib

我不知道为什么会这样,有人知道解决这个问题的方法吗? 谢谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。