2013-07-03 46 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]建立圖書館。它是完全獨立的,所以所有的文件都應該編譯好。

相關問題