前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Windows编译libjpeg库

Windows编译libjpeg库

作者头像
Qt君
发布2019-07-30 20:07:46
3.3K0
发布2019-07-30 20:07:46
举报
文章被收录于专栏:跟Qt君学编程跟Qt君学编程

Qt君最近在做图像相关的项目,用到了libjpeg库。记录libjpeg编译步骤供大家参考。

1.下载源码(jpegsrc9c.zip)

  • 官网地址:
代码语言:javascript
复制
http://www.ijg.org/
  • jepgsrc9c.zip源码包下载地址:
代码语言:javascript
复制
http://www.ijg.org/files/jpegsr9c.zip
  • 如上的下载地址失效可以使用Qt君的github仓库下载:
代码语言:javascript
复制
https://github.com/aeagean/LibjpegForWindows/blob/master/jpeg-9c/jpegsr9c.zip

2.如何找到编译配置方法?

  下载的源码中有一个编译安装教程文件(install.txt)。

  • 从install.txt中摘取的VC++6配置编译方法:
代码语言:javascript
复制
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.
  • 从install.txt中摘取的VS2017配置编译方法:
代码语言:javascript
复制
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.

3.以编译VS2017版本为例

  由于VC++6的编译方法与VS2017方法基本相同,这里使用VS2017的编译环境编译。

3.1 编译步骤

1. 打开VS2017开发者终端,主要是使用VS2017的开发环境。

2. 进入libjpeg库目录,使用NMAKE命令生成VS2017的项目文件(用于编译libjpeg库)。

图示:

命令:

代码语言:javascript
复制
NMAKE /f makefile.vs setup-v15

  这一步可能遇到的问题:如果出现以下情况,可能是你重复调用命令生成,导致文件不能重命名,或你修改了里面的一些文件名字。建议重新解压libjpeg库再执行命令生成。

3. 打开libjpeg库目录的jpeg.sln项目文件。

  这一步可能遇到的问题:

代码语言:javascript
复制
jpeg.vcxproj.filters : warning  : 无法读取筛选器文件“jpeg.vcxproj.filters”。请卸载项目“jpeg.vcxproj”以便对其进行编辑。
jpeg.vcxproj.filters(1,1): 未能加载项目文件。根级别上的数据无效。第 1 行,位置 1。

解决方法:

  • 使用记事本打开jpeg.vcxproj删除第1行的第1个位置的乱码字符;
  • 另存为UTF-8格式并覆盖jpeg.vcxproj文件。
  • 相似的问题可以使用同样的方法解决。

4. 编译

  这一步可能遇到的问题:

  • Windows SDK版本不匹配的问题。

解决方法:修改Windows SDK版本:

  • 提示必须定义入口点的问题:

解决方法:设置动态库或静态库:

3.2 最后编译成功

4.打包好的库和头文件

  • 仅供学习使用。
  • 32位与64位的release版本静态库。
  • 地址:
代码语言:javascript
复制
https://github.com/aeagean/LibjpegForWindows
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-07-26,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Qt君 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.下载源码(jpegsrc9c.zip)
  • 2.如何找到编译配置方法?
  • 3.以编译VS2017版本为例
    • 3.1 编译步骤
      • 1. 打开VS2017开发者终端,主要是使用VS2017的开发环境。
      • 2. 进入libjpeg库目录,使用NMAKE命令生成VS2017的项目文件(用于编译libjpeg库)。
      • 3. 打开libjpeg库目录的jpeg.sln项目文件。
      • 4. 编译
    • 3.2 最后编译成功
    • 4.打包好的库和头文件
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档