Can't get generated project to work with CLion

Hey guys, I’m trying to use PlatformIO to write my Arduino code in CLion, but I can’t get it to work. These are the exact steps I took:

  1. In a new folder “CLionUnoTest”, execute the command platformio init --ide clion --board uno
  2. Make a file /src/main.cpp containing the blink example code
  3. Run platformio run --target upload to verify that everything is working
  4. Open CLion, open project, select the folder

The resulting CLion project doesn’t work. There are 3 things wrong (but I guess they all boil down to the same problem):

I’m using CLion 2016.1.4 and PlatformIO 3.1.0. Cmake 3.7.0-rc1 is also installed on my computer.

I’ve also tried the whole thing with another board (Teensy 3.2) but that didn’t change anything. I don’t have any more ideas on what to try, can you guys help me?

(The image and links are inconsistent because I can only post one image and two links as a new user)

Please read docs carefully Redirecting... and perform ALL steps from “Integration” section.

Repeating all of those steps with the development version gives the same result unfortunately.

I’ve tried a couple more things:

  • The PlatformIO IDE appears to be working fine on my computer.
  • A fresh installation of CLion (with the same init steps as before) results in the following CMake error: Error:add_executable called with incorrect number of arguments on this line of CMakeLists.txt: add_executable(${PROJECT_NAME} ${SRC_LIST})

Let me know if I should try anything else!

You should put some source C/C++ files (not INO) into the project src directory, then re-init project.

Now I’m back to where I started, I got exactly the same problems I described above.

I’ll try to reproduce this issue later and reply here.

Thanks for that! I really appreciate the help.

I’ve just tried to reproduce this issue and all works amazing! Please read docs carefully. Need to click on BUILD button, not RELEASE. We have big screenshot with labels:

Try to use MinGW environment instead Cygwin. I use MinGW 3.22 and bundled with CLion CMake 3.6.2 and everything works fine from the box. To upload a sketch select “PLATFORMIO_UPLOAD” target and press “Build”, not “Run”. I hope this helps.

I’m sorry I didn’t get back yo you guys sooner.

When I now try to repeat all of the previous steps I get the following error while opening the project in CLion (I can’t post a clickable link because I’m a new user):

The only thing that I think has changed is that I have installed the PlatofrmIO IDE.