CMake Error: The current CMakeCache.txt directory /home/tamgmeng/catkin_ws/src/Ros_Qt5_Gui_App/CMakeCache.txt is different than the directory /home/ubuntu/wheeltec_robot/src/Ros_Qt5_Gui_App where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
时间: 2024-02-04 10:04:22 浏览: 226
这个错误通常是由于在不同的目录下运行了 CMake 工具导致的。你可以尝试清理 CMake 缓存并重新运行 CMake 工具,或者在正确的目录下重新运行 CMake 工具。具体操作如下:
1. 删除当前目录下的 CMakeCache.txt 文件。
2. 进入正确的目录,重新运行 CMake 工具。
3. 如果出现类似的错误,可以尝试在正确的目录下删除 CMake 缓存并重新运行 CMake 工具。
相关问题
mportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg' Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH. CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message): execute_process(/home/k/anaconda3/bin/python3 "/opt/ros/noetic/share/catkin/cmake/parse_package_xml.py" "/opt/ros/noetic/share/catkin/cmake/../package.xml" "/home/k/catkin_ws/build/catkin/catkin_generated/version/package.cmake") returned error code 1 Call Stack (most recent call first): /opt/ros/noetic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process) /opt/ros/noetic/share/catkin/cmake/all.cmake:168 (_catkin_package_xml) /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:20 (include) CMakeLists.txt:58 (find_package) -- Configuring incomplete, errors occurred! See also "/home/k/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also "/home/k/catkin_ws/build/CMakeFiles/CMakeError.log". Invoking "cmake" failed
这个错误是因为您缺少了catkin_pkg模块。您需要安装catkin_pkg模块并将其添加到PYTHONPATH中。您可以通过以下命令安装它:
```
pip install catkin_pkg
```
然后,将以下命令添加到您的.bashrc文件中,将catkin_pkg添加到PYTHONPATH中:
```
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages:/home/k/.local/lib/python3.8/site-packages:/opt/ros/noetic/lib/python3/dist-packages
```
请将上述命令中的路径更改为您计算机上实际安装的catkin_pkg模块的路径。完成后,重新启动终端并尝试重新构建您的代码。
The source "/home/ji/ros_catkin_ws/src/rosconsole-concise_output_roso/CMakeLists.txt" does not match the source "/home/ji/ros_catkin_ws/src/rosconsole/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.
这个问题可能是由于缓存不匹配导致的。建议重新运行 cmake,并指定一个不同的源代码目录。你可以尝试以下步骤来解决这个问题:
1. 删除构建目录:`rm -rf /home/ji/ros_catkin_ws/build`
2. 创建一个新的构建目录:`mkdir /home/ji/ros_catkin_ws/build`
3. 进入构建目录:`cd /home/ji/ros_catkin_ws/build`
4. 运行 cmake 命令,并指定正确的源代码目录:`cmake /home/ji/ros_catkin_ws/src/rosconsole`
5. 编译代码:`make`
这样应该可以解决源代码不匹配的问题,让 cmake 使用正确的源代码目录重新生成缓存。如果问题仍然存在,请确保源代码目录的路径正确无误,并且没有其他文件或目录与之冲突。
阅读全文