I have a simple sketch that compiles for the 'nana every' but fails to compile for the 'MKR wifi 1010' with the compile errors like the following
error: cannot declare member function 'static void Assert_::assertTrue(const char *msg, bool result)' to have static linkage [-fpermissive]
My code has a header and a c++ file
The header contains something like
#ifndef ASSERT_H
#define ASSERT_H
class Assert_ {
public:
static void assertTrue(const char *msg, bool result);
};
#enif
the cpp file contains something like
#include "Arduino.h"
#include "assert.h"
....
static void Assert_::assertTrue(const char *msg, bool result) {
.....
}
and of course the main sketch has stuff like
#include "Arduino.h"
#include "assert.h"
void setup() {
Assert_::assertTrue( "passes", true);
Why does it compile for one device and not for the other?
I am using IDE 2.3.2 and running Ubuntu 22
I have include my complete source code
assert.h (201 Bytes)
[assert.cpp|attachment](upload://gLQxkJ4OMvBbgDSESwjqvzNubq9.cpp) (666 Bytes)
[assert_test.ino|attachment](upload://km2V2Z6c2HkX2k4NEUpuV8HwgZY.ino) (237 Bytes)