Cmake Error: could not load cache

2019-04-03 01:35发布

I'm using Cmake to try to build a project for Eclipse. When I try running Cmake, I get the following error:

Error: could not load cache
Error: Batch build stopped due to Eclipse CDT4 - Unix Makefiles error.
---- Time Elapsed: 3 secs ----
Error: could not load cache
Error: Batch build stopped due to Eclipse CDT4 - Unix Makefiles error.

I'm completely stumped on what might be causing this. I know that I'm running Cmake in the correct directory and the CMakeCache.txt file is present. Could someone point me in the right direction to solve this?

标签: cmake
6条回答
你好瞎i
2楼-- · 2019-04-03 02:19

In your example Eclipse must run something like

cmake --build folder_name --target all

and I opt that the *folder_name* is bad in this case. You probably messed something up in Eclipse.

查看更多
Anthone
3楼-- · 2019-04-03 02:20

The most realistic answer and personal experienced answer is

  1. If you are using Clion and building files with IDE
  2. And getting the error Cmake Error: could not load cache
  3. Because you have accidentally deleted the cache file (like me: permanently and cant get back) or there is other problems or other problems

Then do this:

Run -> Clean

Run -> Build

And your project will be working all fine

查看更多
够拽才男人
4楼-- · 2019-04-03 02:28

Remove the CMakeCache.txt and try again. You probably had a bad cmake setup.

查看更多
迷人小祖宗
5楼-- · 2019-04-03 02:28

For me it helps to select CMake tab (next to Run, TODO) in CLion. Then click the Reload CMakeProject button.

查看更多
The star\"
6楼-- · 2019-04-03 02:30

If you are using the CLion, you can use File---"Reload CMake Project".

I meet this problem after using git force pull, and Reload CMake Project solves it.

查看更多
我只想做你的唯一
7楼-- · 2019-04-03 02:38

If you are absolutely positive that you are running the build command from the binary directory, this error probably means that you have had an issue during the configuration/generation step that you should have ran before trying the build. You can try to configure again to check (cmake your-build-dir)

I would advise running the Gui and trying to load the cache to see if you get a more explicit error (although I doubt it).

Another possibility would be to try to create a new clean build directory and take it from there.

查看更多
登录 后发表回答