编译protobuf-3.4.0,报错:cl is not a full path and was not found in the PATH.

编译protobuf-3.4.0,报错:cl is not a full path and was not found in the PATH.

当时编译protobuf时一直在报错,编译命令是:

cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake

尝试了很多方法失败后去stack overflow问了问,我把我的提问详细放上来吧(嫌啰嗦的可以直接看最后)

我的提问

(用的是谷歌翻译后的英文,这里我就把中文也丢上来方便看)
我想把onnx转成ncnn,在编译protobuf的时候,我先在cmake中建了一个“build”文件夹,用两个不同的文件夹分别放“release”和“debug”的配置
I want to convert onnx to ncnn, when compiling protobuf, I first built a “build” folder in cmake, and used two different folders to put the configuration of “release” and “debug” respectively:
在这里插入图片描述
我下载的protobuf文件目录如下:
The protobuf file directory I downloaded is as follows:
在这里插入图片描述
我已经下载了 cmake 和 git
I have downloaded cmake and git
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
编译命令:
compile command:

cmake -G "NMake Makefiles"  -DCMAKE_BUILD_TYPE=Release  -DCMAKE_INSTALL_PREFIX=../../../../install  ../..

当我在 windows 上安装 protobuf 时,总是会出现这个问题:
This problem always occurs when I install protobuf on windows:
在这里插入图片描述
在这里插入图片描述
它一直显示 CMakeLists.txt 的问题。
它表明没有路径,是因为没有路径吗?
It keeps showing a problem with CMakeLists.txt
And it shows that there is no path, is it because there is no path?
在这里插入图片描述
如果是,添加哪个路径?
If yes, which path to add?

大佬回答

The first command is just wrong and the output message explains this. In the second screenshot cmake is trying to find the Visual Studio compiler, but it it doesn’t succeed, since either there’s no visual studio installed or the compiler wasn’t added to the PATH environment variable; this is explained rather clearly in the cmake output too. The path for me btw would be C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14..\bin\Hostx**

第一个命令是错误的,输出消息解释了这一点。 在第二个屏幕截图中,cmake 试图找到 Visual Studio 编译器,但它没有成功,因为没有安装 Visual Studio,或者编译器没有添加到 PATH 环境变量中; 这在 cmake 输出中也得到了相当清楚的解释。 顺便说一句,我的路径是
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14..\bin\Hostx**

解决方法

原本我在C盘没找到编译器,准备卸载,结果卸载时跳出了我安装Visual Studio的路径,发现我把它下在了D盘,按着大佬给的路径找到我的路径后,加到了PATH里。
在这里插入图片描述
在这里插入图片描述
总而言之,就是是visual studio 编译器的路径没有放。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值