I have been struggling for several days now. I love using CLion, but I have the problem whereby I can take code that compiles just fine in the Arduino IDE and copy it into a Platformio project in CLion setup for the Arduino and it will not compile:
====================[ Build | Production | uno ]================================ "C:\Program Files\JetBrains\CLion 2021.3.3\bin\cmake\win\bin\cmake.exe" --build C:\Users\320051849\CLionProjects\untitled6\cmake-build-uno --target Production
Even more frustrating is that the build just hangs, without giving me any feedback as to what the problem is. I’ve narrowed it down to the inclusion of a library header file - when this is included, the build hangs. In this case it is a library for controlling a LCD from the arduino. I get the same issue whether it is the UTFT library, the LCD_WIKI libraries or (most recently) the DFRobot_GDL library - all result in the same problem. Bear in mind that these are example HW libraries that all work fine in the Arduino IDE!
I’ve tried both copying the library files to the /lib directory as well as adding the Arduino library path to the platformio.ini file. In both cases, after re-init, CLion is able to find the libraries, but the #include statement causes the build to hang. If I remove the #include statement, the build completes successfully and the program is uploaded to the Arduino, but of course I then have no support for my LCD!
I’ve also tried switching from the default compiler to the AVR-GCC and AVR-G++ compilers from the AVR toolchain but it makes no difference.
I’m tearing out what little hair I have left at this stage. I don’t want to give up on the CLion/PlatformIO combination, but I am out of ideas at this stage and I can’t afford to waste any more time on this.
Has anyone else perhaps experienced this issue, or could lend some advice? It would be most gratefully received!
I am using the latest version of PlatformIO and also of CLion, my board is an Arduino Mega (I also have an Uno, same problem) and I am running Windows 10.