MeMCore.h contains a definition. Ouch!


#1

A no-no for header files: MeMCore.h defines the array mePort. That means that if a library includes MeMCore.h and the code using the library does also, the symbol is multiply defined.

The workaround, assuming the library code doesn’t actually need mePort (mine doesn’t), is to include MeMCore.h in one of the two places like this:

#define mePort mePort_kill
#include "MeMCore.h"
#undef mePort

If the code really does need mePort, it can just declare it:

#define mePort mePort_kill
#include "MeMCore.h"
#undef mePort
extern MePort_Sig mePort[];

Searching around for problems with multiply defined mePort, I see a lot of people stumped by this.

(To make any sense of my post, one needs to know the distinction between a definition and a declaration.)

The Makeblock library needs to be fixed!


#2

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.