Qt君最近在做图像相关的项目,用到了libjpeg库。记录libjpeg编译步骤供大家参考。
http://www.ijg.org/
http://www.ijg.org/files/jpegsr9c.zip
https://github.com/aeagean/LibjpegForWindows/blob/master/jpeg-9c/jpegsr9c.zip
下载的源码中有一个编译安装教程文件(install.txt)。
Microsoft Windows, Microsoft Visual C++ 6 Developer Studio:
To use:
1. Open the command prompt, change to the main directory and execute the
command line
NMAKE /f makefile.vs setup-vc6
This will move jconfig.vc to jconfig.h and makefiles to project files.
(Note that the renaming is critical!)
2. Open the workspace file jpeg.dsw, build the library project.
(If you are using Developer Studio more recent than 6.0, you'll
probably get a message saying that the project files are being updated.)
3. Open the workspace file apps.dsw, build the application projects.
4. To perform the self-test, execute the command line
NMAKE /f makefile.vs test-build
5. Move the application .exe files from `app`\Release to an
appropriate location on your path.
Microsoft Windows, Visual Studio 2017 (v15):
To use:
1. Open the Developer Command Prompt, change to the main directory and
execute the command line
NMAKE /f makefile.vs setup-v15
This will move jconfig.vc to jconfig.h and makefiles to project files.
(Note that the renaming is critical!)
2. Open the solution file jpeg.sln, build the library project.
a) If you are using Visual Studio more recent than
2017 (v15), you'll probably get a message saying
that the project files are being updated.
b) If necessary, open the project properties and
adapt the Windows Target Platform Version in
the Configuration Properties, General section;
we support the latest version at the time of release.
3. Open the solution file apps.sln, build the application projects.
4. To perform the self-test, execute the command line
NMAKE /f makefile.vs test-build
5. Move the application .exe files from `app`\Release to an
appropriate location on your path.
由于VC++6的编译方法与VS2017方法基本相同,这里使用VS2017的编译环境编译。
图示:
命令:
NMAKE /f makefile.vs setup-v15
这一步可能遇到的问题:如果出现以下情况,可能是你重复调用命令生成,导致文件不能重命名,或你修改了里面的一些文件名字。建议重新解压libjpeg库再执行命令生成。
这一步可能遇到的问题:
jpeg.vcxproj.filters : warning : 无法读取筛选器文件“jpeg.vcxproj.filters”。请卸载项目“jpeg.vcxproj”以便对其进行编辑。
jpeg.vcxproj.filters(1,1): 未能加载项目文件。根级别上的数据无效。第 1 行,位置 1。
解决方法:
这一步可能遇到的问题:
解决方法:修改Windows SDK版本:
解决方法:设置动态库或静态库:
https://github.com/aeagean/LibjpegForWindows