2013-07-03 26 views
0

我有一个与BOOST中的Generic Image Library有关的问题。在使用该库的开始,我尝试使用下面的代码读取JPEG图像:当我在BOOST中使用通用图像库时应该安装jpeg库吗

rgb8_image_t img; 
jpeg_read_image("test.jpg",img); 

然而,当我编译的代码,我有以下错误:

error C1083: Cannot open include file: 'jpeglib.h': No such file or directory 

我找到jpeglib.h不是库中的文件,因此我认为在使用这个库时必须安装jpeg库。但是,当在因特网上找不到有关它的信息时。我现在在Windows环境下使用VC10库,并且应该在使用通用图像库之前编译JPEG库?此外,我应该静态还是动态地编译JPEG库?我应该将库放在通用图像库中哪里?

回答

2

我认为你的答案可以找到here

看起来你不需要在boost之前编译libjpeg,但是在构建使用jpeg I/O函数的代码时,你确实需要它。

1

我遇到了同样的问题。助推GIL与来自www.ijg.org的独立外部图书馆密切相关(似乎大部分是德国人)。对于微软平台, 我发现没有安装程序 - 您必须编译源代码。对我来说更糟糕的是 ,有一些Visual Studio配置文件,但不是v。8. 所以我从头开始创建自己的解决方案/项目。不要惊慌,这不是 如此糟糕。它很容易编译。简而言之,这是如何:

[1]从www.ijg.org下载源代码压缩文件jpegsr9b.zip。

[2]在解压源代码树的目录中的某个地方创建一个简单的基于控制台的Visual Studio项目(“jconfig”)。只添加1个源代码文件:ckconfig.c。编译并运行程序。它将生成一个头文件jconfig.h。将此文件复制或移动到主源代码目录 - 此软件包中只有一个包含源代码的目录。 [3] make another Visual Studio project that will create the library for the JPG package. Configure the project to make a library (I assume you know how), and include the JPG package source code directory in the "Additional Include Directories" configuration parameter. [4]包含所有的源代码文件(它们都是.c文件),除了以下内容:rdjpgcom.c,wrjpgcom.c和jpegtran.c。这些文件是独立程序(每个都带有main() - 显然你不希望它们在库中)。 [5] exclude 2 of the following files (ie, include only 1 of these files): jmemname.c, jmemnobs.c, or jmemansi.c. They contain a different implementations of a "memory manager". I used jmemnobs.c, as the comments indicated it was the simplest implementation, and I just wanted the code to work and was in a hurry. So, in other words, if you did step [4] and included all .c files, now take out 2 of the 3 files listed from your main project file. [6]建立图书馆。它是完全独立的,所以所有的文件都应该编译好。

相关问题