的Visual Studio 2013和libpng [英] Visual Studio 2013 and libpng
问题描述
我想写使用VS2013使用C中的libpng一个简单的PNG文件。从我安装的NuGet的libpng,其中包括png.h,但我不能编译。我得到这个作为我的输出:
I'm trying to write a simple PNG file using libpng in C using VS2013. I installed libpng from Nuget and included png.h, but I can't compile. I get this as my output:
1>main.obj : error LNK2019: unresolved external symbol png_create_write_struct referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_set_longjmp_fn referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_create_info_struct referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_write_info referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_destroy_write_struct referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_init_io referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_free_data referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_set_IHDR referenced in function writeImage
1>main.obj : error LNK2019: unresolved external symbol png_set_text referenced in function writeImage
我试着编译设置打,但似乎没有任何使其工作。我不明白在任何时候那些我写的code声明的任何红线,所以VS必须看到一些code的。
I've tried playing with the compilation settings, but nothing seems to make it work. I don't get any red lines under any of those declarations when I write the code, so VS must be seeing some of the code.
推荐答案
此外,包括 png.h
您还必须用适当的导入库(可能称为链接 libpng.lib
或类似的东西)。在Visual Studio中,可以添加这的项目设置→连接器→输入→附加依赖的
Besides including png.h
you must also link with the appropriate import library (probably called libpng.lib
or something similar). In Visual Studio, you would add this to Project Settings → Linker → Input → Additional Dependencies.
这篇关于的Visual Studio 2013和libpng的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!