Apologies. This probably comes from me mostly programming in Free Pascal ...
I keep on getting the following message when compiling my C code in Visual Studio 2022:
ld.exe: CIS030925.cpp.o: in function setup
CIS030925.ino:61: undefined reference to SDClass begin(unsigned char)
ld.exe: D:\CISRewrite030924\CIS030925\CIS030925.ino:65: undefined reference to SD
collect2.exe*: error: ld returned 1 exit status
**The error is generated at the line if (!SD.begin(BUILTIN_SDCARD))
I have tried copying the SD.h file in with my working files, I've tried pointing to it with the full path and I've tried pointing to it in the default location. I've tried putting it after all the other includes in case it was being supplanted. I've assumed that the type of BUILTIN_SD is correct.
Many thanks for telling me that I am an idiot and should stick with Pascal ...
Here is the main module:
I keep on getting the following message when compiling my C code in Visual Studio 2022:
ld.exe: CIS030925.cpp.o: in function setup
CIS030925.ino:61: undefined reference to SDClass begin(unsigned char)
ld.exe: D:\CISRewrite030924\CIS030925\CIS030925.ino:65: undefined reference to SD
collect2.exe*: error: ld returned 1 exit status
**The error is generated at the line if (!SD.begin(BUILTIN_SDCARD))
I have tried copying the SD.h file in with my working files, I've tried pointing to it with the full path and I've tried pointing to it in the default location. I've tried putting it after all the other includes in case it was being supplanted. I've assumed that the type of BUILTIN_SD is correct.
Many thanks for telling me that I am an idiot and should stick with Pascal ...
Here is the main module:
Code:
#include <Arduino.h>
#include <TimeLib.h> //for teensy
#include <Wire.h>
//#include "dispatchTimer.hpp"
//#include <SD.h>
#include <SPI.h>
#include <math.h>
#include "consts.hpp"
#include "globals.hpp"
#include "errors.hpp"
#include "macros.hpp"
#include "hutils.hpp"
#include "analogi2c.hpp"
#include "dispatchTimer.hpp"
#include "hsd_read.hpp"
#include "rpm.hpp"
#include "timing.hpp"
#include "fuelPump.hpp"
#include "readpins.hpp"
#include "pwm.hpp"
#include "pinInit.cpp"
#include "initialiseSystem.hpp"
//#include <C:\Users\hkems\AppData\Local\arduino15\packages\teensy\hardware\avr\1.59.0\libraries\SD\src\SD.h>
#include <SD.h>
void setup()
{
setPins();
initialiseErrors();
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial1) {
; // wait for serial port to connect.
}
if (!bitRead(USB1_PORTSC1, 7))
{
//usb connected
;
}
else
{
//usb disconnected
setError (SERIALCONNECTIONFAIL);
}
setMyTime (now());
//Initialise onboard SD
if (!SD.begin(BUILTIN_SDCARD))
{
setError(SDFOUNDFAIL);
return;
}
// initialiseSystem();
}
void loop()
{
//This is the operating system
dispatchTimer () ; //
}