CLion Project Libs

I’m trying to keep some of my project factored into private libraries in the hope of keeping elements self-contained and exposing features through public methods.

When I do that, I have two main problems…

  1. When I build from within the IDE, the errors show in the console for files belonging to a copy of my source file.

It’s awesome to have the IDE hyperlink the error, but unfortunately it’s opening up the .pioenvs copy of the source file :frowning:

Is there any way to set up the project to use the source file directly, or to “fix” the error link to open the actual source file when clicked?

  1. The private library source files are not showing as source files of the project.

I expect that the lib/Display/src/ files be enabled and actively part of the project. And the main reason for wanting that is the IDE seems to ignore the file and the mistakes within it, even while editing it.

This is what I expect:

And this is what happens with a “non-project” file from the libs/ directory:

(The _tft.fillScreen( call should have a highlight and a suggestion from the IDE to fix it)

I’ve tried putting the .h/.cpp files directly in the ‘lib/Display’ library folder, and as shown here in the ‘lib/Display/src’. I don’t find any difference between them.

Maybe both issues are related? And the normal assistance you get from the IDE pointing out errors is missing because it’s “pre-compiling” the project and the errors are in the .pioenvs directory structure and it doesn’t know to highlight the actual source file?

Either way, I find both error message clicking, and error/warning highlighting within project files very helpful… I’m hoping it’s just me doing something wrong, or somehow solvable.

Sorry for the late answer. I worked on this issue… The problem with relative paths is fixed in this issue:

Please try in virtual environment new PlatformIO 3.0. Please don’t install it globally! :warning: The instruction is in the issue below.

What do you think? :blush:
PlatformIO 3.0 History:

Thanks Ivan.

I’ve installed pio3 in a virtual env.

Just want to confirm that I should take a copy of my project, and initialise it again with pio3?

You don’t need to make a copy. The high level API(project structure, PlatformIO.ini) is compatible between two versions.

Are there any other steps?

(pio3dev) $ which platformio
(pio3dev) $ platformio --version
PlatformIO, version 3.0.0.dev9

In CLion I make sure it’s using that python virtualenv:

I still see all errors hyperlinked to .pioenvs:

arm-none-eabi-ar rcs .pioenvs/teensy31/libSPI.a .pioenvs/teensy31/SPI/SPI.o
.pioenvs/teensy31/Display/Display.cpp: In constructor 'Display::Display(int8_t, int8_t, int8_t, int8_t)':
.pioenvs/teensy31/Display/Display.cpp:18:16: error: request for member 'needsBackground' in '((Display*)this)->Display::_tftUpdate', which is of pointer type 'TFTUpdate*' (maybe you meant to use '->' ?)
_tftUpdate.needsBackground = true;

Did you re-init the project with PlatformIO 3.0?

(pio3dev) $ pio init -d /path/to/project --ide clion

That was the ticket. Working well with linking to the actual file with the error/warning…

Is it safe to keep using v3 instead of switching back to current?

I test source code very well before committing. What is more, we have a lot of different integration tests. I would be thankful if you will use v3 and report any problems (I’m not sure that you will have them).

Nevertheless, I’m going to release the first public beta of PlatformIO 3.0 next week. Need to finish with new Library Manager. Here is the commits history. If you will see new critical commits, please repeat pip install in your python virtual environment.

I’m getting a library import error (missing a define) when I switch to 3. Where should I log that? A new post here, or in GitHub? (Error is in both command-line, and CLion IDE)

Please make a new post here. If it is an error, we will move it to GitHub. Thanks.