povray debian下安装报错collect2: error: ld returned 1 exit status



functionImf_2_2::TypedAttributestd::string::typeName() const':
openexr.cpp:(.text._ZNK7Imf_2_214TypedAttributeISsE8typeNameEv[_ZNK7Imf_2_214TypedAttributeISsE8typeNameEv]+0x1): undefined reference to Imf_2_2::TypedAttribute::staticTypeName()' ../source/libpovray.a(openexr.o):(.rodata._ZTVN7Imf_2_214TypedAttributeISsEE[_ZTVN7Imf_2_214TypedAttributeISsEE]+0x30): undefined reference toImf_2_2::TypedAttributestd::string::writeValueTo(Imf_2_2::OStream&, int) const'
../source/libpovray.a(openexr.o):(.rodata._ZTVN7Imf_2_214TypedAttributeISsEE[_ZTVN7Imf_2_214TypedAttributeISsEE]+0x38): undefined reference to Imf_2_2::TypedAttribute::readValueFrom(Imf_2_2::IStream&, int, int)' collect2: error: ld returned 1 exit status Makefile:460: recipe for target 'povray' failed make[2]: *** [povray] Error 1 make[2]: Leaving directory '/root/povray/unix' Makefile:654: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/root/povray' Makefile:446: recipe for target 'all' failed make: *** [all] Error 2


报错提示中主要错误是: undefined reference toImf_2_2::TypedAttributestd
这个问题很奇怪。
google 之后发现有类似问题,猜测可能原因服务器安装的c++编译环境太老了,然后写代码的环境可能是新的c++版本。
这个问题就来了。
尝试升级



apt-get install gcc
apt-get install build-essential

apt-get install build-essential这个命令把所有要安装的全部都安装好。build-essential是c/c++语言的开发包,包含了gcc、g++、make、gdb和libc等函数库,很多工具。