私がクライアントのために行っているいくつかの作業では、Red Hat Enterprise で非常に古いバージョンの gcc を使用してビルドする必要があります。最近 4.x から 5.3 に移行しましたが、単純な例をビルドしようとするとコンパイル エラーが発生します。
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
return 0;
}
私は以下を取得します:
bash-3.2$ g++ -o hello hello.cpp
In file included from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_alloc.h:90,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/memory:55,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/string:48,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/bits/localefwd.h:49,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/ios:48,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/ostream:45,
from /opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/iostream:45,
from hello.cpp:1:
/opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_threads.h: In
constructor `std::_Refcount_Base::_Refcount_Base(unsigned int)':
/opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_threads.h:74: error: `
__LOCK_INITIALIZER' undeclared (first use this function)
/opt/ext/gcc-3.2.3.34rh/include/c++/3.2.3/bits/stl_threads.h:74: error: (Each
undeclared identifier is reported only once for each function it appears
in.)
__LOCK_INITIALIZER
は pthreads マクロですが、ここで直接使用していないことは明らかです。以前にこの種の問題を見たことがありますか、またはこれがなぜ起こっているのかとして考えられる提案を提供できますか?