I have the following problem
this code (a minimal, single file version of the MTP-responder)
generates this Link error
Not sure how to solve this problem
this code (a minimal, single file version of the MTP-responder)
Code:
#include "SD.h"
class mSD_Base
{
public:
mSD_Base(FS *sd) {sdx=sd;}
File sd_open(uint32_t store, const char *filename, uint32_t mode)
{ if(!cs || (cs[store]<256)) return ((SDClass *)&sdx[store])->open(filename,mode);
else return 0;
}
private:
FS *sdx;
const int *cs = 0;
};
class MTPStorageInterface {
public:
virtual void OpenFile(char *filename, uint32_t mode = FILE_READ)=0;
};
class MTPStorage_SD : public MTPStorageInterface, mSD_Base {
public:
MTPStorage_SD(FS *fs): mSD_Base(fs) {}
void OpenFile(char *filename, uint32_t mode = FILE_READ) {sd_open(0,filename,mode);}
};
class MTPD {
public:
explicit MTPD(MTPStorageInterface* storage): storage_(storage) {}
void open(char *filename){storage_->OpenFile(filename);}
private:
MTPStorageInterface* storage_;
};
void setup() {
// put your setup code here, to run once:
FS sdx[1];
MTPStorage_SD storage(sdx);
MTPD mtpd(&storage);
mtpd.open((char *)"test");
}
void loop() {
// put your main code here, to run repeatedly:
}
generates this Link error
Code:
C:\Users\zimmer\Documents\Arduino\TestVtable/TestVtable.ino:47: undefined reference to `vtable for FS'
Not sure how to solve this problem