1 year, 8 months ago.

Why this code does not compile with the GCC ARM toolchain?

The following code compiles fine with the online compiler (using the ARM toolchain):

#include "mbed.h"
 
InterruptIn myPins[] = { InterruptIn(p21), InterruptIn(p22), InterruptIn(p23) };
 
int main() {}

But it doesn't when trying to compile offline with the Mbed CLI using the GNU ARM toolchain:

Compile [ 98.9%]: main.cpp
[Error] InterruptIn.h@62,7: 'mbed::NonCopyable<T>::NonCopyable(const mbed::NonCopyable<T>&) [with T = mbed::InterruptIn]' is private within this context
[ERROR] In file included from d:/src/arm/mbed/mbed/drivers/UARTSerial.h:27:0,
                 from d:/src/arm/mbed/mbed/mbed.h:73,
                 from .\main.cpp:1:
d:/src/arm/mbed/mbed/drivers/InterruptIn.h: In copy constructor 'mbed::InterruptIn::InterruptIn(const mbed::InterruptIn&)':
d:/src/arm/mbed/mbed/drivers/InterruptIn.h:62:7: error: 'mbed::NonCopyable<T>::NonCopyable(const mbed::NonCopyable<T>&) [with T = mbed::InterruptIn]' is private within this context
 class InterruptIn : private NonCopyable<InterruptIn> {
       ^~~~~~~~~~~
In file included from d:/src/arm/mbed/mbed/platform/PlatformMutex.h:20:0,
                 from d:/src/arm/mbed/mbed/drivers/BusIn.h:22,
                 from d:/src/arm/mbed/mbed/mbed.h:56,
                 from .\main.cpp:1:
d:/src/arm/mbed/mbed/platform/NonCopyable.h:218:5: note: declared private here
     NonCopyable(const NonCopyable &);
     ^~~~~~~~~~~
.\main.cpp: At global scope:
.\main.cpp:3:79: note: synthesized method 'mbed::InterruptIn::InterruptIn(const mbed::InterruptIn&)' first required here 
 InterruptIn myPins[] = { InterruptIn(p21), InterruptIn(p22), InterruptIn(p23) };
                                                                               ^
Be the first to answer this question.