skip to Main Content

I use visual studio code with the current espressif plugin (IDF version 5.1.2). The following program can be compiled and executed on the esp32 without any problems:

#include <iostream>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "main.h"

void HelloCMake::run(int i)
{
    std::cout << "Hello World from C++ "<< i << 'n';
    vTaskDelay(pdMS_TO_TICKS(1000));
}

extern "C" void app_main(void)
{
    HelloCMake App;
    int i = 0;

    while (true)
    {
        App.run(i);
        i++;
    }    
}

However, the editor shows me the following:

  1. identifier "vTaskDelay" is undefined
  2. identifier "pdMS_TO_TICKS" is undefined

Why are the two problems still displayed? And how can I solve this, please?

Thanks!

Markus

enter image description here

Translated with DeepL.com (free version)

Asked Google and ChatGPT…

2

Answers


  1. Chosen as BEST ANSWER

    Thank you đź‘Ś

    I found this article and activate the recursive search configuration. Now i have a working syntax highlightning.


  2. you need to add esp include path to JSON file for syntax recognition in VScode editor. Compile and IDE syntax highlight is 2 different things, IDE environment emphasis error because it does not able to find the declaration of the function, nothing to do with compile.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search