【异常处理】The CXX compiler identification is unknown

从 NGC 里面下了一个容器,想在里面加个 opencv,cmake 的时候遇到问题:

root@ff2ae4aa882a:~/hive/repository/opencv/opencv-4.5.0/build# cmake ..
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:109 (enable_language):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

很明显,这是没有找到 c++的编译器,查了一下,还真没有 c++或者 g++,果断安装相应的包。

root@ff2ae4aa882a:~/hive/repository/opencv/opencv-4.5.0/build# apt install build-essential

再看一下:

root@ff2ae4aa882a:~/hive/repository/opencv/opencv-4.5.0/build# which c++
/usr/bin/c++
root@ff2ae4aa882a:~/hive/repository/opencv/opencv-4.5.0/build# which g++
/usr/bin/g++

有了,再 cmake 一下:

root@ff2ae4aa882a:~/hive/repository/opencv/opencv-4.5.0/build# cmake ..
-- The CXX compiler identification is GNU 7.5.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works

...

ok!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值