PlatformIO Community

CLion can't find Arduino.h Header and other system headers

I was using VSCode for my Platformio IDE, but it was not performing nicely and I wanted to try something different.
I found out that CLion works quite nice, but I got one small problem. I can’t view the standard Arduino Classes, methods and Headers. It compiles but it doesn’t show up right in CLion.

I’m on Windows 10 Version 2004

It neither works with my complex code nor with a simple empty starting sketch.

If any of you knows how to combat this problem, it would be nice if you could help me

What does it look like (screenshot)?

Have you installed the “PlatformIO for CLion” extension as per https://docs.platformio.org/en/latest/integration/ide/clion.html?

It looks like that. Normal Squiggle line…
2020-07-17

And yes I have the Extension installed. It neither works when using the cli nor when I create it using the extension.

Whats your platformio.ini, code as text (markdown) and CLion version?

It’s no general problem as you can see in the following screenshot

image

if your file is located under src - as I assume - and not under test. If the later is true, there is an open issue as you can see here:


resp.
https://youtrack.jetbrains.com/issue/CPP-21173

Nevertheless you could try to re-init your project (located under Tools -> PlatformIO -> Re-Init)

Thank’s for that.
I’m also getting this problem. I’m not very familiar with CMake, so I don’t know what it wants to do…

Cannot get compiler information:
Compiler exited with error code 1: C:\Users\user\.platformio\packages\toolchain-atmelavr\bin\avr-gcc.exe @C:\Users\user\AppData\Local\Temp\response-file10290307188185867260 C:\Users\user\AppData\Local\Temp\compiler-file596410696221276006 | @response-file10290307188185867260=/TC -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\include -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\Base -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\SD -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\Sleep_n0m1 -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\TroykaMQ\src -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\NRFLite\src -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\RF24 -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\RF24\utility "-IC:\Users\user\GitStuff\NEW_SAM\BETTER~1\PIO~1\libdeps\uno\ADAFRU~2" -IC:\Users\user\.platformio\packages\framework-arduino-avr\libraries\Wire\src -IC:\Users\user\.platformio\packages\framework-arduino-avr\libraries\SPI\src "-IC:\Users\user\GitStuff\NEW_SAM\BETTER~1\PIO~1\libdeps\uno\DHTSEN~1" "-IC:\Users\user\GitStuff\NEW_SAM\BETTER~1\PIO~1\libdeps\uno\ADAFRU~1" -IC:\Users\user\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\user\.platformio\packages\framework-arduino-avr\variants\standard -IC:\Users\user\.platformio\packages\framework-arduino-avr\libraries\EEPROM\src -IC:\Users\user\.platformio\packages\framework-arduino-avr\libraries\HID\src -IC:\Users\user\.platformio\packages\framework-arduino-avr\libraries\SoftwareSerial\src -IC:\Users\user\.platformio\packages\toolchain-atmelavr\lib\gcc\avr\5.4.0\include -IC:\Users\user\.platformio\packages\toolchain-atmelavr\lib\gcc\avr\5.4.0\include-fixed -IC:\Users\user\.platformio\packages\toolchain-atmelavr\avr\include -IC:\Users\user\.platformio\packages\tool-unity -std=gnu11 -fno-fat-lto-objects -fmax-errors=5 -g -fmerge-all-constants -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega328p "-D'PLATFORMIO=40304'" "-D'ARDUINO_AVR_UNO'" "-D'__BASE_FIRMWARE__'" "-D'F_CPU=16000000L'" "-D'ARDUINO_ARCH_AVR'" "-D'ARDUINO=10808'" "-D'__AVR_ATmega328P__'" /Be /Bd /EP
avr-gcc.exe: error: /TC: No such file or directory
avr-gcc.exe: error: /Be: No such file or directory
avr-gcc.exe: error: /Bd: No such file or directory
avr-gcc.exe: error: /EP: No such file or directory


Compiler exited with error code 1: C:\Users\user\.platformio\packages\toolchain-atmelavr\bin\avr-g++.exe @C:\Users\user\AppData\Local\Temp\response-file4191781524868230156 C:\Users\user\AppData\Local\Temp\compiler-file596410696221276006 | @response-file4191781524868230156=/TP -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\include -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\Base -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\SD -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\Sleep_n0m1 -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\TroykaMQ\src -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\NRFLite\src -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\RF24 -IC:\Users\user\GitStuff\NEW_SAM\BetterBase\.pio\libdeps\uno\RF24\utility "-IC:\Users\user\GitStuff\NEW_SAM\BETTER~1\PIO~1\libdeps\uno\ADAFRU~2" -IC:\Users\user\.platformio\packages\framework-arduino-avr\libraries\Wire\src -IC:\Users\user\.platformio\packages\framework-arduino-avr\libraries\SPI\src "-IC:\Users\user\GitStuff\NEW_SAM\BETTER~1\PIO~1\libdeps\uno\DHTSEN~1" "-IC:\Users\user\GitStuff\NEW_SAM\BETTER~1\PIO~1\libdeps\uno\ADAFRU~1" -IC:\Users\user\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\user\.platformio\packages\framework-arduino-avr\variants\standard -IC:\Users\user\.platformio\packages\framework-arduino-avr\libraries\EEPROM\src -IC:\Users\user\.platformio\packages\framework-arduino-avr\libraries\HID\src -IC:\Users\user\.platformio\packages\framework-arduino-avr\libraries\SoftwareSerial\src -IC:\Users\user\.platformio\packages\toolchain-atmelavr\lib\gcc\avr\5.4.0\include -IC:\Users\user\.platformio\packages\toolchain-atmelavr\lib\gcc\avr\5.4.0\include-fixed -IC:\Users\user\.platformio\packages\toolchain-atmelavr\avr\include -IC:\Users\user\.platformio\packages\tool-unity -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -fmax-errors=5 -g -fmerge-all-constants -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega328p "-D'PLATFORMIO=40304'" "-D'ARDUINO_AVR_UNO'" "-D'__BASE_FIRMWARE__'" "-D'F_CPU=16000000L'" "-D'ARDUINO_ARCH_AVR'" "-D'ARDUINO=10808'" "-D'__AVR_ATmega328P__'" /Be /Bd /EP
avr-g++.exe: error: /TP: No such file or directory
avr-g++.exe: error: /Be: No such file or directory
avr-g++.exe: error: /Bd: No such file or directory
avr-g++.exe: error: /EP: No such file or directory

[Failed to reload]

Seems like compiler discovery fails fatally.

The config is the following

[platformio]
src_dir      = Base
default_envs = uno

[common]
default_src_filter = +<src/*> 
build_flags       = -fmax-errors=5
                    -g -D__BASE_FIRMWARE__
                    -fmerge-all-constants
lib_deps          = DHT sensor library
                    Adafruit BMP280 Library
                    RF24
                    NRFLite
                    TroykaMQ

# Globally defined properties
# inherited by all environments
[env]
framework         = arduino
build_flags       = ${common.build_flags}
lib_deps          = ${common.lib_deps}
monitor_speed     = 115200
lib_ldf_mode      = chain+

[env:uno]
platform          = atmelavr
board             = uno
lib_deps          = ${common.lib_deps}
                    Sleep_n0m1
                    161 # SD Lib
                    Wire

Try to rename your source file from .c to .cpp extension.
Next version of the plugin is going to fix Arduino.h problem.

About compiler exited with error - a toolchain with gcc for the desktop should be set up.
This is a workaround for now, we’re working on the problem.

I only use cpp source files. The fact that this error is fixed in the next version would be nice.

I have a gcc toolchain (C++ Build Tools and mingw). Is that enough?

Should be enough.
If your toolchain is in order, then autocomplete(Arduino.h) inside .cpp files should work.

Still can’t find anything as of now

What exact CLion version are you using? Does compiling work from the CLI?

I’m using 202.6397.12 (So the latest beta) which should be compatible. Latest PlatformIO also installed.

Please share the project