Arduino on vscode

Hi,

I'm trying to build my Arduino project with vscode.
My path tree is:
project
-.vscode
-lib
---actuatorLib
----------Actuator.h
----------Actuator.cpp
backend.hpp
project.ino

The compiler didn't recognize the implementation in Actuator.cpp of my method:
backend.hpp:7: undefined reference to 'Actuator::on()'

I'm trying to add to my c_cpp_properties.json
"configurations": [
{
"name": "Win32",
"compilerPath": "C:\mingw-w64\bin\gcc.exe",
"compilerArgs": [],
"intelliSenseMode": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/lib/actuatorLib",

or

"forcedInclude": [
"${workspaceFolder}/lib/actuatorLib/Actuator.hpp",
"${workspaceFolder}/lib/actuatorLib/Actuator.cpp",

but with no success.

If, in backend.hpp, I include the header and the cpp file. Everything works.

I think It's a configuration error.

it does seem a question better suited in a vscode forum...

did you try to compile with the IDE to see if it's a bug in your code or in the configuration?

Yeah. With Arduino IDE everything ok

can't help with vscode but indeed seems a config / path issue. Hopefully some folks using vscode can help out

Are you using Platformio on VSCode?

Im not. I want to try without it

So I can't help you because I'm not using Arduino for VSCode.

I could give some help with PIO.

I’m using PIO too. I’ve got a problem with RTClib.
I inserted it in lib_deps
adafruit/RTClib@^2.1.1
But at compile time in a file in “include” send me an error RTClib.h not such file or directory

With ctrl+click. Everything work. But not during compile

I didn't understand.

Add here files in a zip.

arduino_firmware.zip (689.5 KB)

Here

Add this lines to lib_deps.

	Wire
	SPI
	https://github.com/adafruit/Adafruit_BusIO.git

Also move the file rgbledLib.ino to a folder called examples.

arduino_firmware.zip (2.3 MB)

Ther's RtClib error now

Your problem is not with RTClib but with project structure there are many bad includes.

Look the PIO documentation to understand project organization.

https://docs.platformio.org/en/latest/projectconf/sections/platformio/index.html#directory-options

Which type of bad includes? in .ini file?

I solved putting #include "RTClib.h" before include the other class in eepromlib

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.