天天看點

linux編譯安裝jpeg,Linux下jpeglib庫的安裝詳解

Linux下jpeglib庫的安裝詳解

首先要下載下傳所需的庫壓縮包:jpegsrc.v6b.tar.gz或

jpegsrc.v8b.tar.gz

然後将下載下傳的壓縮包随便放在和解壓到你喜歡的地方。

# tar -zxvf jpegsrc.v6b.tar.gz

# cd jpeg-6b

# ./configure --enable-shared

# make

/以下代碼是在usr/local目錄下建立庫檔案安裝目錄

/如果沒有權限建立輸入指令sudo –s

回車,然後按提示輸入你的登入密碼

# mkdir /usr/local/jpeg6

# mkdir /usr/local/jpeg6/include

# mkdir /usr/local/jpeg6/lib

# mkdir /usr/local/jpeg6/bin

# mkdir /usr/local/jpeg6/man

# mkdir /usr/local/jpeg6/man/man1

# make install

#----configuration information----

echo

"---------------------------------------------------------------------"

echo "please add following lines in you /etc/profile"

echo "("

echo " tip:"

echo " you can add these lines in a file named

/etc/profile.jpeg,"

echo " and then add a line on the end of /etc/profile:"

echo " . /etc/profile.jpeg"

echo " it is simple,:)"

echo "):"

echo " PATH=""$""PATH:$jpeg/bin"

echo "

CPLUS_INCLUDE_PATH=""$""CPLUS_INCLUDE_PATH:$jpeg/include"

echo " LD_LIBRARY_PATH=""$""LD_LIBRARY_PATH:$jpeg/lib"

echo " LIBRARY_PATH=""$""LIBRARY_PATH:$jpeg/lib"

echo " MANPATH=""$""MANPATH:$jpeg/man"

echo ""

echo " export PATH CPLUS_INCLUDE_PATH LD_LIBRARY_PATH

LIBRARY_PATH MANPATH"

這就安裝完了嗎???no!!!

你可能在編譯自己寫的程式的時候會遇到一下問題終端提示

/tmp/cc9DqMJZ.o: In function `jpeg_compress':

server1214.c:(.text+0x4f5): undefined reference to

`jpeg_std_error'

server1214.c:(.text+0x519): undefined reference to

`jpeg_CreateCompress'

server1214.c:(.text+0x59b): undefined reference to

`jpeg_stdio_dest'

server1214.c:(.text+0x5d1): undefined reference to

`jpeg_set_defaults'

server1214.c:(.text+0x5ef): undefined reference to

`jpeg_set_quality'

server1214.c:(.text+0x605): undefined reference to

`jpeg_start_compress'

server1214.c:(.text+0x64c): undefined reference to

`jpeg_write_scanlines'

server1214.c:(.text+0x66a): undefined reference to

`jpeg_finish_compress'

server1214.c:(.text+0x686): undefined reference to

`jpeg_destroy_compress'

collect2: ld 傳回 1

解決辦法在編譯指令後加-ljpeg

例 gcc –o ****

****.c –ljpeg

Ok

成功!!!!