rbaron / b-parasite

🌱💧 An open source DIY soil moisture sensor
1.85k stars 143 forks source link

VSCode - problem with include-files #124

Closed Jones133D closed 1 year ago

Jones133D commented 1 year ago

After I opened the workspace folder of the ble-sample with the ble.code-workspace script as described in the wiki I still have problems finding the include-paths. image image Did I miss something? Do I have to additionally configure something else manually?

Edit: I think I have to change something with cmake paths or cmake configuration, but unfortunally I am a totally beginner nRF Connect and cmake

rbaron commented 1 year ago

It looks like your ble.code-workspace file was changed from the one in the repo (git status should show that):

image

I'm not sure what happened there, but I would make sure the repository is clean (e.g.: git clean -xfd) and open the ble.code-workspace file by either double clicking it or typing code ble.code-workspace in your terminal.

Jones133D commented 1 year ago

Thank you for your help and your awesome project, I am really excited to get my parasites to work!

Unfortunately, I still have the same problem. Just to be sure, I just cloned the git again in an empty folder, opened the ble.code-workspace and clicked on the "Open Workspace"-Button. After that, the BLE (WORKSPACE) opened and startet compiling. I also noticed that automatically on line was added to the ble.code-workspace: image

In the Explorer I can see the folder prstlib was successfully added, but in the source files all the include files still can't be found. Do I have to configure the IntelliSense-Settings (c_cpp_properties.json) to find missing headers like VSCode suggest in the popup here (sorry for having German selected here, I'm changing that right now) image

rbaron commented 1 year ago

The workspace looks correct, but I suspect you're not using the nRFConnect VSCode extension to build the code. Here's how to do it (generic getting started tutorial from Nordic) (linked in the Wiki under the "... usual way to do it"). You can skip to step 8, since you're not creating a new application. Make sure to select the correct b-parasite board and revision as described in the Wiki

Let us know how it goes.

Jones133D commented 1 year ago

Yes, in the screenshot above I forgot to add a build configuration and cmake startet to compile automatically without the nRFConnect VSCode extension. After added a Build Configuration again, it seems to build the hex-file correctly. image

But, I still get errors about every include-file in the editor. Is this normal and I just have to ignore them or do I have to change some other settings? Maybe in the Edit Build Configuration page of the nRFConnect VSCode extension? Is it correctly that it says No fragments available under Kconfig fragments? Do I have to choose Use build system default or prj.conf under Configuration? And is it right, that only this line is addet under Extra CMake arguments: -DBOARD_ROOT:STRING="c:/local_workspace/b-parasite_new/b-parasite/code/nrf-connect/prstlib"

I also tried to add all the missing paths to the c_cpp_properties.json, which seemed to work fine first, but endet later by not finding only alloca.h (dependency of rb.h --> sched_priq.h --> kernel_includes.h --> kernel.h --> led.h and some other dependencys under led.h, everytime alloca.h). The funny thing is, this alloca.h really isn't on my entire PC disc.

rbaron commented 1 year ago

Here's what my build edit tab looks like in a clean repository (never built):

Screenshot 2023-05-08 at 08 42 59

Also in a clean directory (before building it), the extension also gives me include errors.

Screenshot 2023-05-08 at 08 38 05

After clicking "Build configuration", the include errors are resolved:

Screenshot 2023-05-08 at 08 43 30

And the build edit tab looks like this:

Screenshot 2023-05-08 at 08 46 10

I suggest:

  1. Double checking you're starting from a clean repository (e.g. git clean -xfd)
  2. Creating the build config with default values (including build directory build)
  3. Building the config and checking if the imports are resolved (and the build is successful)
  4. Restarting VSCode

If that doesn't work, I would try building one of the built-in samples from Nordic as described in the Nordic docs and see if that works for your environment.

rbaron commented 1 year ago

Closing due to inactivity. @Jones133D Please feel free to reopen if you still need assistance.