編譯Linux c++代碼的幾個問題
1.c++項目移植到不同版本的linux平臺,需要重新編譯一次。可能并不能順利地編譯通過,
問題可能出現(xiàn):gcc編譯器的版本,較高版的,對語法的檢查更加的嚴格,遇到的問題是,
include文件的依賴,template語法的聲明,所依賴的系統(tǒng)庫的缺失,在64位系統(tǒng)下編譯
32位程序等等。
2./usr/bin/ld: cannot find -lstdc++ 解決
sudo yum search "static" |grep "\(libc\|stdc\+\+\)"
將搜索到到包,安裝上就行了。
3.x86_64 Linux Error: gnu/stub-32.h
Fix for the RHEL/CentOS 5.x for GCC gnu/stub-32.h missing error
Type the following yum command:
# yum -y install glibc-devel.i386
Fix for the RHEL/CentOS 6.x for GCC gnu/stub-32.h missing error
Type the following yum command:
# yum -y install glibc-devel.i686 glibc-devel
請索引幫助文檔:
http://www.cyberciti.biz/faq/x86_64-linux-error-gnustub-32h-missing-error-and-solution/
4. uuid/uuid.h 找不到
yum -y install libuuid-devel