1.1 現象
目標機器上運行./hello,報告: /lib/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by ./hello)
1.2 解決
交叉編譯機器:
strings libc/usr/lib/libstdc++.so.6.0.14 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
目標機器:
strings /lib/libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBC_2.4
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
判斷是目標機器上的版本比較老,靜態鏈接(打開 -static選項), 問題解決
2. shared_ptr.h:61:46: error: '_Lock_policy' has not been declared 問題
2.1 現象
加入#include<shared_ptr.h>, 編譯,報告 version `GLIBCXX_3.4.14' not found, 及/usr/include/c++/4.4.3/tr1/shared_ptr.h:61:46: error: '_Lock_policy' has not been declared 等一大堆問題
2.2 解決
求助度娘,在http://stackoverflow.com/questions/5170670/include-tr1shared-ptr有說要
#include <memory>
加入memory聲明, 問題解決