PlatformIO Community

Debug simple native platform program in CLion

Hey guys. I’m evaluating platformio for cross platform development. Look promising so far. Impressive work Ivan!

Just trying to simply debug a “hello world” program using platformio and CLion on OSX.

#include <iostream>
int main() {
    std::cout << "Hello World\n";
}

My platform io contains:
[env:native-build]
platform = native
build_flags = -std=gnu++11

I can get this to compile by building “PLATFORMIO_BUILD_DEBUG” and I can run it from terminal.

I get an error in CLion about the #include line. How can I fix that?

I made a custom run target using PLATFORMIO_BUILD_DEBUG and specifying the executable under dir “.pio/build/native-build”. Is this the correct approach?

Thankyou!

Please add a directory where this header is located to -I .... See https://docs.platformio.org/en/latest/projectconf/section_env_build.html#build-flags