I was also facing this issue, when trying to compile cpp files. check that you have in your top CMakeLists.txt: cmake_minimum_required(VERSION 3.6) set(CMAKE_CXX_STANDARD 17) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(myproj) And in main/myproj.cpp: extern "C" void app_main(void) { .....