Gameduino2 and Wire errors

/Users/ivanmindlin/Repos/Bing-Project/libs/BingMachine/src/v3/BingMachineV3.h:4:10: fatal error: SdFat.h: No such file or directory

Hm, what are the first say 5 lines of that file? Does it do any condition #if ... including there? Does the BingMachine library folder has a library.json with some build options?

Regarding the library.json file i must admit i did put it in the .pio/libdeps folder because i understood it had to be in the library folder. But when i recompile the library.json file remains and in fact i am not getting anymore my previous error.

There wasn’t any library.json in the BingMachine folder.
This are the first few lines in SdFat (which is in a .pio folder)

#ifndef SdFat_h
#define SdFat_h
/**
* \file
* \brief SdFat class
*/
#include "SysCall.h"
#include "BlockDriver.h"
#include "FatLib/FatLib.h"
#include "SdCard/SdioCard.h"
#if INCLUDE_SDIOS
#include "sdios.h"
#endif // INCLUDE_SDIOS
/** SdFat version 1.1.2 */
#define SD_FAT_VERSION 10102

Sorry I meant the first 5 or so lines of this file ^.

To make it safer you can use my fork https://github.com/maxgerhardt/gd2-lib.git or create your own – usually the .pio folder is not pushed and to be viewed as volatile, temporary.

/Users/ivanmindlin/Repos/Bing-Project/libs/BingMachine/src/v3/BingMachineV3.h:

#ifndef __BINGMACHINEV3_HH__
#define __BINGMACHINEV3_HH__
// Audio Includes
#include <SdFat.h>
#include <AudioI2S.h>

// Touch Screen Includes
#include <GD2.h>

// Motor Includes
#include <Adafruit_DRV2605.h>

// Visual Includes
#include <Adafruit_LEDBackpack.h>

#include <DueFlashStorage.h>

Hm this looks all good and straight forward. Quite unusual that PlatformIO has problems with this. You can try and add a library.json to the BingMachine folder that declares the greiman/SdFat @ ^1.1.4 (and other) dependencies, see docs. Does that help?

So i started from scratch, made my modifications using your fork instead of in the .pio file. That didn’t work, so i made the library.json file (Adding just the names, versions and authors) for the BingMachine file. But i was getting an “undefined reference to loop and main” in this an another module. The solution was here

So i’m not so sure why defining library.json was the solution because i did not do it in another module, and i understand is optional. Does platformio need this library.json file then?

In any case, thank you for aall your help!

Indeed, when i try to start adding the other modules of the project if i run them with the Build Button in VsCode i get dependency errors, but when i run it with pio run -t clean it works. What does the Build Button run then?

No, -t clean just removes build artefacts, it does not build – It will be “successfull”, but it is the removal of old build files that is successfull, not the compilation of the firmware.

Then i am getting this

...
Building in release mode
Linking .pio/build/release/firmware.elf
.pio/build/release/libFrameworkArduino.a(main.cpp.o): In function `main':
main.cpp:(.text.startup.main+0x1a): undefined reference to `setup'
main.cpp:(.text.startup.main+0x20): undefined reference to `loop'
collect2: error: ld returned 1 exit status
*** [.pio/build/release/firmware.elf] Error 1

BingMachine does not have a loop or main functions, it its just a definition of a Class. Maybe i need i way to indicate that to pio?

The Arduino core is looking for a setup() and loop() function in the “global scope”, not inside a class. The original sketch must have had a setup and loop function somewhere. Can you locate it in a source file?

This is the project structure
Bing-Project
–>external // some external libraries
----->DueFlashStorage
----->ArduinoMD5
---->gd2
----->SdFat
–>libs // where apparently the two main modules are supposed to be plus the Audio one
----->BingMachine
----->BingUI
----->Audio
–>paradigms // where i will implement some protocols
------>GlobalLocal
–>tools // an extra tools folder that still did not come into action
-----> Bing-SdLoader
-----> Bing-SdLoaderInstaller
-----> Bing-SerialUpdater

The only one that has a setup and loop is GlobalLocal, one of the paradigms modules that calls the BingMachine and BingUI. GlobalLocal project does not compile because it says BingMachine is missing Adafruit_DRV2605 which i do have installed. GLobalLocals .ini file has libs/ and external/ folders incorporated.

This is what i get when i try to build the paradigm i get this

In file included from /Users/ivanmindlin/Repos/Boxes_project/Bing-Project/libs/BingMachine/src/BingMachine.h:11:0,
                 from src/main.cpp:3:
/Users/ivanmindlin/Repos/Boxes_project/Bing-Project/libs/BingMachine/src/v3/BingMachineV3.h:11:10: fatal error: Adafruit_DRV2605.h: No such file or directory

**************************************************************************
* Looking for Adafruit_DRV2605.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Adafruit_DRV2605.h"
* Web  > https://registry.platformio.org/search?q=header:Adafruit_DRV2605.h
*
**************************************************************************

 #include <Adafruit_DRV2605.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio/build/debug/src/main.cpp.o] Error 1
====================================================== [FAILED] Took 1.25 seconds ======================================================

Environment    Status    Duration
-------------  --------  ------------

Try creating another library.json with adafruit/Adafruit DRV2605 Library@^1.2.0 as one of its dependencies for the libs/BingMachine folder.

No use

This is the file i have in libs/BingMachine folder

Names and version look all correct, maybe try and remove external-repo fields, it should source it from the registry.

What dependencies does it detect for BingMachine in the dependency graph at the start of compilation?

Dependency Graph
|-- <Adafruit DRV2605 Library> 1.2.0
|   |-- <BingMachine>
|   |   |-- <SdFat> 1.1.0
|   |   |   |-- <SPI> 1.0
|   |   |-- <ArduinoMD5>
|   |   |-- <DueFlashStorage> 1.0.0
|   |   |-- <Adafruit BusIO> 1.11.6
|   |   |   |-- <Wire> 1.0
|   |   |   |-- <SPI> 1.0
|   |   |-- <Wire> 1.0
|   |   |-- <SPI> 1.0
|   |   |-- <Adafruit LED Backpack Library> 1.3.2+sha.508c0e6
|   |   |-- <Adafruit GFX Library> 1.11.1
|   |   |   |-- <SPI> 1.0
|   |   |   |-- <Wire> 1.0
|   |   |-- <BingUI> 0.2
|   |   |   |-- <gd2-lib> 1.3.4
|   |   |   |   |-- <SPI> 1.0
|   |   |-- <AudioI2S> 1.0.1
|   |   |   |-- <SdFat> 1.1.0
|   |   |   |   |-- <SPI> 1.0
|   |   |-- <gd2-lib> 1.3.4
|   |   |   |-- <SPI> 1.0
|-- <Adafruit BusIO> 1.11.6
|   |-- <Wire> 1.0
|   |-- <SPI> 1.0
|-- <Adafruit LED Backpack Library> 1.3.2+sha.508c0e6
|-- <Adafruit GFX Library> 1.11.1
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0
|-- <BingMachine>
|   |-- <SdFat> 1.1.0
|   |   |-- <SPI> 1.0
|   |-- <ArduinoMD5>
|   |-- <DueFlashStorage> 1.0.0
|   |-- <Adafruit BusIO> 1.11.6
|   |   |-- <Wire> 1.0
|   |   |-- <SPI> 1.0
|   |-- <Wire> 1.0
|   |-- <SPI> 1.0
|   |-- <Adafruit LED Backpack Library> 1.3.2+sha.508c0e6
|   |-- <Adafruit GFX Library> 1.11.1
|   |   |-- <SPI> 1.0
|   |   |-- <Wire> 1.0
|   |-- <BingUI> 0.2
|   |   |-- <gd2-lib> 1.3.4
|   |   |   |-- <SPI> 1.0
|   |-- <AudioI2S> 1.0.1
|   |   |-- <SdFat> 1.1.0
|   |   |   |-- <SPI> 1.0
|   |-- <gd2-lib> 1.3.4
|   |   |-- <SPI> 1.0
|-- <BingUI> 0.2
|   |-- <gd2-lib> 1.3.4
|   |   |-- <SPI> 1.0
|-- <AudioI2S> 1.0.1
|   |-- <SdFat> 1.1.0
|   |   |-- <SPI> 1.0
|-- <DueFlashStorage> 1.0.0
|-- <gd2-lib> 1.3.4
|   |-- <SPI> 1.0
|-- <SdFat> 1.1.0
|   |-- <SPI> 1.0

How can the DRV2605 library be dependent on the BingMachine library, that doesn’t look right at all.

Have you added a library.json in the Adafruit DRV2605 library maybe?

Playing around with the lib_ldf_mode does not help?

Yes, now that you say it that is weird. I can try installing everything again, maybe i messed up and ended up with that recurrent dependency

Adafruit DRV2605 does not have a library.json

I played around with deep, chain, and their + versions both in GlobalLocal and in BingMachine

There may also be improvements if you upgrade to the latest 6.x core preview version (CLIpio upgrade --dev).

Nope, no use…

Im gonna try with another computer from scratch. Any of ideas of where could i look for more instalation errors?