Hi,
I have to use this ads1x15 driver which is written in cpp (https://github.com/gavinlyonsrepo/ADS1x15_PICO) but I am not able to compile the same. It gives the following error "error: unknown type name 'class' "
Here is my CMakeLists.txtI have placed the .cpp and other .c files in the src folder. When I compile a normal C code for pico it compiles. But I am having issues with C++.
I have to use this ads1x15 driver which is written in cpp (https://github.com/gavinlyonsrepo/ADS1x15_PICO) but I am not able to compile the same. It gives the following error "error: unknown type name 'class' "
Here is my CMakeLists.txt
Code:
cmake_minimum_required(VERSION 3.12)# Pull in SDK (must be before project)include(pico_sdk_import.cmake)option(TEST "Enable only for trial purposes" ON)project("${PROJECT_NAME}" C CXX)set(CMAKE_CXX_STANDARD 17)if(TEST)project(trial)set(SRCsrc/trial/trial.csrc/ads1x15.cppsrc/gpio.c)else()project(main)set(SRCsrc/main.csrc/gpio.csrc/ads1x15.cpp)endif()set(FREERTOS_KERNEL_PATH "../FreeRTOS-Kernel")# Add the freertos_config for FreeRTOS-Kerneladd_library(freertos_config INTERFACE)# Pull in FreeRTOSinclude(${FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/FreeRTOS_Kernel_import.cmake)# Initialize the SDKpico_sdk_init()add_executable("${PROJECT_NAME}" ${SRC})pico_enable_stdio_usb("${PROJECT_NAME}" 1)pico_enable_stdio_uart("${PROJECT_NAME}" 1)target_include_directories("${PROJECT_NAME}" PUBLIC include freertos_config INTERFACE ${CMAKE_CURRENT_LIST_DIR})target_link_libraries("${PROJECT_NAME}" pico_stdlib hardware_i2c hardware_pwm hardware_dma hardware_uart hardware_adc FreeRTOS-Kernel FreeRTOS-Kernel-Heap4)pico_add_extra_outputs("${PROJECT_NAME}")install(TARGETS "${PROJECT_NAME}")
Statistics: Posted by harsh20 — Mon Dec 02, 2024 6:11 am — Replies 1 — Views 54