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.