本文介绍了Cmake C ++ C ++构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要构建贝叶斯优化程序错误是

I want to build the bayes optimization program error is

The C compiler identification is GNU 4.9.2
The CXX compiler identification is GNU 4.9.2
Check for working C compiler: C:/MinGW/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "C:\MinGW\bin" "cmTryCompileExec2576605559/fast"
Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.2/Modules/CMakeTestCCompiler.cmake:61 (message):

C编译器"C:/MinGW/bin/gcc.exe"无法编译简单的测试程序.

The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program.

它失败,并显示以下输出:

It fails with the following output:

Change Dir: C:/Code-Lite-Test/CMakeFiles/CMakeTmp
Run Build Command:"C:\MinGW\bin" "cmTryCompileExec2576605559/fast"
Access is denied
Generator: execution of make failed.  Make command was: "C:\MinGW\bin"
"cmTryCompileExec2576605559/fast"
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):

我已经从网址 https://bitbucket.org/rmcantin/bayesopt/下载了源尝试构建程序时,我已经下载了适用于Windows的MinGW编译器,错误是:

I have downloaded source from url https://bitbucket.org/rmcantin/bayesopt/ and i have downloaded the MinGW compiler for Windows when I try to build the program the error is:

请帮助我,我在尝试构建贝叶斯优化时也删除了旧的缓存.

Please help me on this I have also deleted the old cache when I try to build the bayes optimization.

推荐答案

您可以先尝试在不使用CMake的情况下编译一个简单的C ++程序.例如.将简单的 main.cpp 存储在用户目录 C:\ Users \< yourname> \ Temp 目录中的某个位置,其中包含以下内容:

You could try to compile a simple C++ program first without CMake. E.g. store a simple main.cpp somewhere in your user directory C:\Users\<yourname>\Temp directory with following content:

int main()
{
   return 0;
}

现在在 C:\ Users \<您的名字> \ Temp 目录中打开CMD窗口并运行:

Now open CMD window in your C:\Users\<yourname>\Temp directory and run:

C:\MinGW\bin\gcc.exe main.cpp -o testprog

如果出现错误弹出窗口,说明缺少的.dll,请在CMD窗口中运行以下命令,然后尝试再次编译:

If an error popup appears that is saying something about a missing .dll, run following command in your CMD window and try to compile again:

set PATH=%PATH%;C:\MinGW\bin

如果必须运行最后一条命令,请永久添加C:\ MinGW \ bin路径.毕竟,应该可以将MinGW作为编译器运行 CMake .

If you had to run the last command, add the C:\MinGW\bin path permanently. After all it should be possible to run CMake with MinGW as compiler.

这篇关于Cmake C ++ C ++构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 12:15