CLion autocompletion is not working

(I have read the other topic here CLion autocompletion not working and it does not solve my issue.)

CLion autocompletion does not work for me. I have initialized the project with platformio init --ide clion -b nodemcu after changing any source code structure. I am on latest PIO dev pio upgrade --dev. I am using the build button for my projects, not the run button. Projects build and upload to my Arduino just fine, but CLion cannot find the include files - files are underlined in red and it says file not found. This causes none of the code completion to work for these include files and the source code is riddled with errors.

Stressing again that actually building and uploading the projects to the Arduino works fine. Then only issue is that CLion cannot find the include files. These files ARE listed in CMakeListsPrivate.txt, such as:

include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src")

I think the following may be the root of the issue. When CMake runs, this is the output:

C:\Users\qt\.CLion2019.3\system\cygwin_cmake\bin\cmake.exe -DCMAKE_BUILD_TYPE=d1 -G "CodeBlocks - Unix Makefiles" /cygdrive/h/projects/arduino/pio-test
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/h/projects/arduino/pio-test/cmake-build-d1

Problems were encountered while collecting compiler information:
	Unexpected compiler output. This compiler might be unsupported.
	If you are using GCC/Clang, please report the bug in https://youtrack.jetbrains.com/issues/CPP.

[Finished]

It looks like the generation works fine but CLion does not recognize the output? I am not super familiar with CMake so I am not sure. Any help would be greatly appreciated as trying to code without autocomplete kind of negates the purpose of having an IDE.

Hello community !

First of all i’m very sorry to up this old topic. But I have EXACTLY the same issue.

I can Build and Upload to my card but i haven’t CLion autocompletion.
The topic mentioned before doesn’t helped me neither :confused:

That’s why I’m asking, if the author of the topic have found a solution or if someone else have one. I would be really happy to try it.

Thanks for your time ! :slight_smile:

Would is the exact platformio.ini, CLion Version and operating system you are working with?

Hello maxgerhardt,

First and foremost thanks for your reply. I have tried everything I could find for this problem :no_mouth: and it is my first PIO’s Project using CLion (It is a bit hard to get CMake especially).

Here is some informations about my configuration :

  • CLion : 2020.2.3
  • OS : Windows Pro x64 v1909
  • PIO : 5.0.1
  • Toolchain : Cygwin v3.1.7
  • CMake : 3.17.3
  • GDB : 8.3.1

platformio.ini

[env:Debug]
ide = clion
platform = espressif8266
board = nodemcuv2
framework = arduino

[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino

Cygwin as toolchain? When building with PIO, the xtensa compiler is autodownloaded and does not require any cygwin. Do you have C:\Users\<user>\.platformio\toolchain-xtensa\bin\xtensa-none-elf-gcc set as your compiler in the CMake toolchain settings?

1 Like

Hum, you right I had the Cygwin compilers configured.

I tried to configure the right compilers because I actually have xtensa compilers and looked how to do it.

While looking to the different documentations I could found, i have seen a difference with CLion. My Toolchains configuration cannot have other environments than those on the screen below :

2020-09-25 22_27_56-Settings

And if I try to make a Cygwin toolchain with custom compilers & debugger it doesn’t work neither.

PS:

Do you have C:\Users\<user>\.platformio\toolchain-xtensa\bin\xtensa-none-elf-gcc

I haven’t exactly this path. I have

C:\Users<user>.platformio\ packages \toolchain-xtensa\bin\xtensa- lx106 -elf-gcc.exe

Ok I get it !

The issue was especially from me and my CLion configuration. I needed to make a MinGW configuration like this one :
image_2020-09-26_151139

Now my autocompletion is working and PIO is using the Xtensa compilers to build and upload. Everything work !