我正在尝试链接libpng16.lib
到我的 .dll 文件,但我无法让它工作。我已经包含libpng16.lib
并zlib.lib
进入项目依赖项(以正确的顺序,首先是 libpng),但仍然会出现png_*
链接错误。
即使我在谷歌搜索的其他解决方案也不起作用。
编辑:
这是日志:
mingw32-g++.exe -Wall -O2 -std=c++11 -Wall -g -c C:\Users\Mark\Documents\CodeBlocks\TextureLoader\TextureLoader.cpp -o obj\Release\TextureLoader.o
C:\Users\Mark\Documents\CodeBlocks\TextureLoader\TextureLoader.cpp: In static member function 'static unsigned int TextureLoader::PNG_Texture_Load(const char*)':
C:\Users\Mark\Documents\CodeBlocks\TextureLoader\TextureLoader.cpp:105:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
mingw32-g++.exe -shared -Wl,--out-implib=bin\Release\libTextureLoader.a -Wl,--dll -LC:\MinGW\include obj\Release\TextureLoader.o -o bin\Release\TextureLoader.dll -lOpenGL32 -lGLu32 -s C:\Users\Mark\Documents\CodeBlocks\TextureLoader\libpng16.lib C:\Users\Mark\Documents\CodeBlocks\TextureLoader\libpng16.lib
obj\Release\TextureLoader.o: In function `ZN13TextureLoader16PNG_Texture_LoadEPKc':
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:27: undefined reference to `png_sig_cmp'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:33: undefined reference to `png_create_read_struct'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:41: undefined reference to `png_create_info_struct'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:50: undefined reference to `png_create_info_struct'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:59: undefined reference to `png_set_longjmp_fn'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:66: undefined reference to `png_init_io'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:68: undefined reference to `png_set_sig_bytes'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:70: undefined reference to `png_read_info'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:77: undefined reference to `png_get_IHDR'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:79: undefined reference to `png_read_update_info'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:81: undefined reference to `png_get_rowbytes'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:109: undefined reference to `png_read_image'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:123: undefined reference to `png_destroy_read_struct'
C:/Users/Mark/Documents/CodeBlocks/TextureLoader/TextureLoader.cpp:100: undefined reference to `png_destroy_read_struct'