My customer can compile my sketch with no problems but when he attempts to upload the sketch to the Mega 2560 R3 board, he gets a list of errors related to the code in one of the included files. He is running Windows 10 and using Arduino version 1.8.19.
I have no problem compiling or uploading the sketch on my Windows 7 and Windows 10 computers.
** HERE IS THE INCLUDED CODE **
//========================================
// Copy string cSource to cDest and prevent overflow
//========================================
void stringCpy(char * cDest, char * cSource, int nLen)
{
int n = 0;
strcpy(cDest, "");
for (n = 0; n < nLen; n++) {
cDest[n] = cSource[n];
}
cDest[nLen] = NULL;
}
//=======================================
// Determine the number of "cDelim" in "cSource".
//=======================================
int countData(char * cSource, char * cDelim)
{
char * cPos;
char * cBeg;
int nCnt = 0;
//* INITIALIZATION
cBeg = cSource;
if (cSource[0] == NULL) return 0;
//* MAIN PROCESSING
cPos = strstr(cBeg, cDelim);
while (cPos != NULL) {
nCnt += 1;
cBeg = cPos + strlen(cDelim);
cPos = strstr(cBeg, cDelim);
}
return nCnt;
}
** HERE ARE SOME OF THE ERROR S**
Arduino: 1.8.19 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
In file included from C:\DEVELOPMENT\NASDIO\NASDIO.ino:14:0:
C:/DEVELOPMENT/NASDIO/GenLib.h: In function 'void stringCpy(char*, char*, int)':
C:/DEVELOPMENT/NASDIO/GenLib.h:36:19: warning: converting to non-pointer type 'char' from NULL [-Wconversion-null]
cDest[nLen] = NULL;
^~~~
C:/DEVELOPMENT/NASDIO/GenLib.h: In function 'int countData(char*, char*)':
C:/DEVELOPMENT/NASDIO/GenLib.h:134:23: warning: NULL used in arithmetic [-Wpointer-arith]
if (cSource[0] == NULL) return 0;
^~~~
Thanks in advance,
Nick Amendola