要在windows上编译libjpeg库,我们可以按照以下步骤进行操作。这些步骤包括下载源代码、了解编译配置方法以及实际编译过程。
1. 下载源码
您可以从以下两个地址下载jpegsrc9c.zip源码包:
官方网站:https://www.php.cn/link/c1092c40dfa01c731017bd0dd7cf63ef备用地址(如果官方地址失效):https://www.php.cn/link/68d9b6f0ca40f114c048f4a91d701085

2. 编译配置方法
下载的源码中包含一个名为
install.txt
的文件,该文件详细说明了如何在不同环境下配置和编译libjpeg库。以下是从
install.txt
中摘取的VC++6和VS2017的配置方法:
VC++6配置编译方法
Microsoft Windows, Microsoft Visual C++ 6 Developer Studio:To use:1. Open the command prompt, change to the main directory and execute the command lineNMAKE /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 lineNMAKE /f makefile.vs test-build5. Move the application .exe files from `app`Release to an appropriate location on your path.
VS2017配置编译方法
Microsoft Windows, Visual Studio 2017 (v15):To use:1. Open the Developer Command Prompt, change to the main directory and execute the command lineNMAKE /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 than2017 (v15), you'll probably get a message sayingthat the project files are being updated. b) If necessary, open the project properties andadapt 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 lineNMAKE /f makefile.vs test-build5. Move the application .exe files from `app`Release to an appropriate location on your path.
3. 编译VS2017版本
由于VC++6的编译方法与VS2017方法基本相同,这里我们使用VS2017的编译环境进行编译。
3.1 编译步骤
打开VS2017开发者终端:主要是使用VS2017的开发环境。

进入libjpeg库目录,使用NMAKE命令生成VS2017的项目文件:

命令:
NMAKE /f makefile.vs setup-v15
如果出现以下情况,可能是你重复调用命令生成,导致文件不能重命名,或你修改了里面的一些文件名字。建议重新解压libjpeg库再执行命令生成。

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

可能遇到的问题:
jpeg.vcxproj.filters : warning : 无法读取筛选器文件“jpeg.vcxproj.filters”。请卸载项目“jpeg.vcxproj”以便对其进行编辑。jpeg.vcxproj.filters(1,1): 未能加载项目文件。根级别上的数据无效。第 1 行,位置 1。
解决方法:使用记事本打开
jpeg.vcxproj
,删除第1行的第1个位置的乱码字符;另存为UTF-8格式并覆盖
jpeg.vcxproj
文件。相似的问题可以使用同样的方法解决。

编译:
可能遇到的问题:
Windows SDK版本不匹配的问题:

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


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

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

3.2 最后编译成功

4. 打包好的库和头文件

仅供学习使用。32位与64位的release版本静态库。地址:
https://github.com/aeagean/LibjpegForWindows
通过以上步骤,您可以在Windows上成功编译libjpeg库,并获得打包好的库和头文件。
以上就是Windows编译libjpeg库的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/131588.html
微信扫一扫
支付宝扫一扫