Library Dependency Finder does not find code

Hello,

After trying unsuccessfully to get PlatformIO-IDE working with Microsoft Visual Studio Code, I’m currently trying it with Atom. I’ve installed both following your instructions. Here, too, I stumble from one problem to the next.
I’ve created a small project as shown in the picture.
The “Library Dependency Finder” does not seem to work: Code in the subdirectories of “Lib” is neither compiled nor linked.
What has to happen, what do I have to do to make it working (and I run into the next problem)?
I tried to enter the line in the platformio.ini file
lib_ldf_mode = chain
but it has no effect!

Thanks in advance,
Michael

Hey !

I am a new user of platformio and it is working really good with platformio. Were you using a esp32 board ?
What was the issue with vscode ?

I can’t help for atom never used it. For you error on atom, we need the first error on the terminal to help you. The other error are often due to the first one.
Please past the whole terminal response and a link to your code. Was your code working elsewhere ?

Library inclusion in PaltformIO happens through detecting wether the code in src/ does an #include with a filename foudn in one the library folders in lib (or in the declared lib_deps. Since your library has 0 includes (which also begs the question on how functions are exposed?); the LDF will find nothing. Add resepctive .h files to the lib declaring each function and type that is implemented in them, then #include it in main.c.

1 Like

Hello Max,

I understand…
But which kind of files are to be placed in the project subdir “include”?
According to the “README” in this directory I’ve to place the include files with declarations of “objects” implemented in lib and used in “main.c”. Is it wrong?

Kind Regards,
Michael

In my experience, any header files used by the main sources, ie not libraries, can live in the include directory. When compiling the main sources, this directory, and src are searched for headers.

When any included libraries are compiling, then include is not scanned for headers. Only the directories under the lib are scanned.

Turn on verbose compilation and run a “clean” followed by a fresh build to see the sources and library compilation command lines, you will see which directories are being scanned if you look for all the -I (upper case letter “eye”) options.

I tend to add my own classes’ headers either to src mainly, but sometimes, because I’m a bit weird :wink:, to include. I prefer just putting headers in src for everything that is not a library.

HTH

Cheers,
Norm.

By convention headers complementary to source code in src/ should live in include/.

Headers belonging to library code should live in the same folder as the library implementation, as a pair.

Hello,

I followed these instructions. Now the code is fully compiled.
I have some more questions before I move on:

  1. How can I prevent closing the terminal window if the compilation was successful. I want to see that it was successful. In addition, there are sometimes warnings that you want to see and/or have to follow up! (Under Settings, “platformio-ide-terminal” “Close terminal on exit” it is probably not)
  2. Is it possible to turn on a vertical scroll bar in the terminal window?
  3. The contents of the terminal window cannot be copied! Is it a settings issue? I could not find any settings to solve it.

Thanks in advance,
Michael

PlatformIO will not close the terminal on its own. After building it stays like

forever until, as it says, you press a key. If it autocloses, you probably have some non-default setting on or an extension does it for you.

There is a vertical (up, down) scroll bar right there.

Contents can be copied by selecting the text an pressing Ctrl+C. While there is no right-click menu, it does copy it into the clipboard.

E.g.

RAM:   [==        ]  24.0% (used 23620 bytes from 98304 bytes)
Flash: [          ]   3.7% (used 29412 bytes from 786432 bytes)

I put myself wrong: I meant the window in which the compiler output occurs.

I found the item “Toggle Build Panel” in the menus, which opens this window again.
Perhaps I was a little too hasty here. Sorry!

This window does not display any vertical scrollbar!
And it is not possible to copy its content. neitiher by using Ctrl-C nor by using the mouse.

The output which files were compiled (and compiler warnings) appear in that same window.

I’m suspecting you’re having some extensions installed which mod the behavior. Can you show a screenshot of your VSCode instance / terminal after a ‘Build’ was done?

Sorry, I have a question that I can’t find an answer to in the documentation:
The compiler output window tells me that the code was compiled in “release mode”. I can’t find any hint on how to compile the code in “debug mode”.

build_type.

When you hit “Debug” in the debug sidepanel, it will also auto-compile in debug mode, while using debug-mode build flags here.

Max,

I buried Visual Studio Code months ago and removed it from all of my computers because it just messes up. Did you forget it?

I try to get PllatformIO runnung/usable with Atom!

Oh then it’s a different story regarding how the terminal looks. The repo is at Sunsetting Atom | The GitHub Blog for the terminal, looks like you primarily have a problem with that. You can try opening an issue there.