Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4526

Troubleshooting • Using std::mutex in RPi Pico fails. (cmake)

$
0
0
Hello everyone.
I have been looking at this problem for a few days now and cannot seem to find the answer in any online forums/ document.
This is what im doing: I have a RPi 3B connected via USN to a RPi Pico. I SSH with my computer to the 3B, and have all of the project stored in that device.
I'm using cmake to compile and run everything. After typing cmake .. , I then type sudo make VERBOSE=1.

Here is a snapshot of the CMakeLists.txt in the build directory:
CMakeLists.txt

Code:

cmake_minimum_required(VERSION 3.10)set(PICO_SDK_FETCH_FROM_GIT on)set(PICO_SDK_PATH "/home/nicoc/PovGlobe/depes/pico-sdk")include(/home/nicoc/PovGlobe/depes/pico-sdk/pico_sdk_init.cmake)project(PovGlobe)set(EXT_DIR ./ext)set(PICO_SDK_FETCH_FROM_GIT on)set(PYTHON_LIBRARIES "/usr/lib/aarch64-linux-gnu/libpython3.11.so")set(PYTHON_INCLUDE_DIRS "/usr/include/python3.11")pico_sdk_init()set(CORE_LIB_NAME ${CMAKE_PROJECT_NAME}_core_lib)set(HW_LIB_EXT_NAME ${CMAKE_PROJECT_NAME}_hw_lib_ext)set(SIM_LIB_EXT_NAME ${CMAKE_PROJECT_NAME}_sim_lib_ext)set(APPS_LIB_NAME ${CMAKE_PROJECT_NAME}_apps_lib)set(PY_WRAPPER_LIB_NAME Py${CMAKE_PROJECT_NAME})set(EXEC_MAIN_NAME ${CMAKE_PROJECT_NAME})if(NOT CMAKE_BUILD_TYPE)  set(CMAKE_BUILD_TYPE Release)endif()set(CMAKE_CXX_STANDARD 14)set(CMAKE_CXX_STANDARD_REQUIRED ON)...
This is the error I get after some time:

Code:

[ 50%] Building CXX object cpp_src/PovGlobe/sim/CMakeFiles/PovGlobe_sim_lib_ext.dir/renderer_sim.cpp.objcd /home/nicoc/PovGlobe/build/cpp_src/PovGlobe/sim && /usr/bin/arm-none-eabi-g++ -DSIM_AVAILABLE  -Wall -Wextra -O3 -std=gnu++14 -MD -MT cpp_src/PovGlobe/sim/CMakeFiles/PovGlobe_sim_lib_ext.dir/renderer_sim.cpp.obj -MF CMakeFiles/PovGlobe_sim_lib_ext.dir/renderer_sim.cpp.obj.d -o CMakeFiles/PovGlobe_sim_lib_ext.dir/renderer_sim.cpp.obj -c /home/nicoc/PovGlobe/cpp_src/PovGlobe/sim/renderer_sim.cpp(skipping warnings)/home/nicoc/PovGlobe/cpp_src/PovGlobe/sim/../core/globe.hpp:9:1: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?    8 | #include "helper.hpp"  +++ |+#include <mutex>    9 | #include <mutex>/home/nicoc/PovGlobe/cpp_src/PovGlobe/sim/../core/globe.hpp:69:10: error: 'mutex' in namespace 'std' does not name a type   69 |     std::mutex m_double_buffer_mutex;      |          ^~~~~/home/nicoc/PovGlobe/cpp_src/PovGlobe/sim/../core/globe.hpp:69:5: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?   69 |     std::mutex m_double_buffer_mutex;      |     ^~~
You can even see during the traceback that mutex is already included (and even then it suggests including it again)
There are two hpp files that use sdt::mutex and both of them throw the error in almost the extact same way.
Is there a problem with my compiler? Should i add another library to the cmake file?
Thanks a lot everyone.

Statistics: Posted by nicoleich — Thu Apr 25, 2024 11:08 am — Replies 0 — Views 25



Viewing all articles
Browse latest Browse all 4526

Trending Articles