VS Code Configuration Warning in DaisyExamples

Hello,

I ordered an Electro Smith Daisy Field and it should get in tomorrow. In preparation, I am trying to set up my development environment.

Context

  • I am a seasoned TypeScript developer with zero experience in C++.
  • I work on an M1 Mac.
  • I am very comfortable in the cli.

I installed arm-none-eabi-gcc using brew as follows:

brew install armmbed/formulae/arm-none-eabi-gcc

Compiling Works :tada:

From the cli I have successfully compiled both libraries (libDaisy and DaisySP) and two of the examples (field/KeyboardTest and patch/PluckEcho).

VS Code Configuration Warning

When I open VS Code, I get the following error in output of the C/C++ Configuration:

Unable to resolve configuration with compilerPath 
  "/usr/local/bin/arm-none-eabi-g++". 
Using "/usr/bin/clang" instead.

Note that VS Code is looking for arm-none-eabi-g++ in /usr/local instead of /opt/homebrew, which is the default for brew:

/opt/homebrew/bin/arm-none-eabi-g++

Errors in VS Code

As you can see in the screenshot, the language server seems to have problems with some of the code:

PolyPluck is not a template          C/C++(864)

identifier "ReverbSc" is undefined   C/C++(20)

I assume that this might have to do with the failing configuration.

Am I missing anything obvious?

This explains the ReverbSx error, possibly the other,too.

In short, add USE_DAISYSP_LGPL=1to the Makefile.

@tele_player Thanks for your super quick reply!

Unfortunately this is not the root of my problems. At least, that is what I think…

I use the latest version of electro-smith/DaisyExamples. As such, the Makefile already contains the USE_DAISYSP_LGPL constant:

TARGET = PluckEcho

USE_DAISYSP_LGPL = 1

# Sources
CPP_SOURCES = PluckEcho.cpp

# ...

As noted in the initial post, compiling in the cli works perfectly. The problem I am trying to solve relates to VS Code exclusively.

UPDATE

After changing the "compilerPath" in .vscode/c_cpp_properties.json as follows, the error regarding C/C++ Configuration is gone:

       "cStandard": "c11",
-      "compilerPath": "/usr/local/bin/arm-none-eabi-g++",
+      "compilerPath": "/opt/homebrew/bin/arm-none-eabi-g++",
       "cppStandard": "c++17",

This being said, the errors in the .cpp files remian:

PolyPluck is not a template          C/C++(864)

identifier "ReverbSc" is undefined   C/C++(20)

Did you try the Quick Fix suggestions?

@tele_player thanks for sticking with me. I am not entirely sure I understand what Quick Fix suggestions you mean.

Adding #define USE_DAISYSP_LGPL 1 to the top of the cpp file fixed the errors in VS Code.

It is not satisfactory to have to define the makro in my file, given that others do not seem to need this.

It will do for now. My c++ skills are almost non-existant, so debugging this is not a task I am up to for now. Maybe in the future.

Look at your screen shot, it shows Quick Fix, which you click for a suggestion, but not necessarily the best solution.

Agreed, having to use a define in your source file is less desirable, but put a comment near it explaining it’s an imperfect workaround, and life goes on.

I normal just work with vi and command line, I find VS code setup confusing.

Hi,

Am having same or similar problem.

Attempting to build MultiEffect example with daisy pod The code, which I have not altered, has the following two includes:

#include “daisysp.h”
#include “daisy_pod.h”

But the two lines to create static ReverbSc and Tone variables are failing, explaining that the identifiers are undefined. From my inexperienced perspective this looks like an include problem, but not sure how to fix as both types are described in the daisysp API docs (so are presumably included with daisysp.h). Appreciate any suggestions. Being new to C++ obviously doesn’t help…

Sorry, just to provide a bit more context:

  • I can build and run the SimpleLed example fine.
  • I have the relevant using namespace lines (in the original code)

It occurs to me that rather than a code issue (assuming the examples all work) it is more likely a configuration issue. I followed your " How to Set Up Your C++ Development Environment" but wondering if I’m missing something? Have I properly built the libraries? Does task “build all” build everything needed, even when just in a particular example directory?

@Brogan So I haven’t this completely figured out.

Adding the following line at the top of my .cpp file did partly resolve the issue with the VS Code language sever:

#define USE_DAISYSP_LGPL 1

I’ll be hacking in on this today, so feel free to hit me up on the Discord server. Maybe we can pair-program our way through this. This is my username: monsieur_caillou

Another option is to add the following to your .vscode/c_cpp_properties.json:

{
  "configurations": [
    {
      // ...
      "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE",
        "USE_DAISYSP_LGPL" <---
      ]
    }
  ]
}

Thanks, I’ll have a go at those two options. I’d take up your Discord offer (appreciated!) but suspect we may be in different time zones. I’m in Australia and its mid-evening here.

Ok, I got the MultiEffects example within the pod directory to work. It was missing the following include:

#include “daisysp-lgpl.h”

That enabled me to include ReverbSc and Tone.

I figured this out by rewriting the types to check the auto-complete options. Those two classes were not available so I went looking through DaisySP directory to find the header files. I found them in the DaisySP-LGPL directory.