An error information appeared when debugging the native C example of platformio

Platformio can be used as an IDE of native C programming. In the “Porject Examples”:

a Native example named “hello-world” can be imported:

But there is an annoying little problem when debugging:

Is there anyway to solve this information?
Best regards.

This message is also often triggered when mouse-hovering over an expression that is not a variable, it doesn’t have any effect and can be closed.

Thank you.
There is another problem:
when stepping over printf(), no message printed in the “TERMINAL” below. I think “Hello World from PlatformIO!” should be printed when stepping over.
Is there anyway to solve this problem?
Best regards.

What’s in the “Debug Console”?

It is:

Okay, and when you step over the printf()?

I’m sorry, I can not understand “when”…
I click the step over button when the yellow arrow located at line 5, after click step over button, the yellow arrow moves to line 6, as the following picture shows:

Is there new output at the bottom of the “Debug Console” tab?

There is no output at the bottom of the “Debug Console” tab:

I checked every tabs, no “Hello World from PlatformIO!” appeared:

I find the message appeared in the “Debug Console” tab when click the “continue” button:

But it is not what I expected, because it does not meet the expectations of steps debugging.

Yeah the message probably does not appear directly because of buffering / flushing. A fflush(stdout); after the printf() may help so that the message directly appears when the fflush(); line is stepped over.

Great, after add fflush(stdout); , the message directly appears.
By the way, if I do not want to add fflush(stdout); , is there anyway to configure in somewhere, such as in platformio.ini, or c_cpp_properties.json located at .vscode folder, etc, to let the message directly appears?
Best regards.

As one of the first commands in your main() program you can just disable buffering for the stdout stream.


then you don’t need fflush() anymore and the output should appear directly after the printf().

You can additionally wrap this in

//disable buffering


if you only want this behavior when debugging and not during a normal build + run.

Thank you.
There is another problem when using scanf():

#include <stdio.h>

int main()
    setbuf(stdout, NULL);

    printf("Hello World from PlatformIO!\n");

    int i;
    printf("i = ");
    scanf(" %d", &i);
    printf("%d\n", i);

    return 0;

I feel it’s hard to describe the phenomenon in my poor English, then I upload the .gif to this:
It can be downloaded.
Best regards.