Arduino IDE: Sketch takes infinite time to compile


I have an Arduino sketch with about 50 files (.cpp and .h) and some included libraries and I am developing for a Teensy 3.1 so I have the Teensyduino addon for the Arduino IDE.

My code compiles fine, if I remove/change some lines. But it doesn't matter which lines exactly.

For example if there is an array as a member-variable and I change it to a pointer, it doesn't compile anymore, giving me no error, but freezing the compile-process. The progress-bar stays at about 25%.

It seems to me, like the parser/compiler hangs up.

Disabling anti-virus doesn't change something.

Any suggestions how to fix this?

I would suggest that you turn on the "Show verbose output during: [X] compiling [ ] upload" in the Preferences. This way you will at least know which file or what compiler step that fails.


I did so and the last command executed is a compile command of the file where I changed the array to the pointer.

C:\Program Files (x86)\Arduino/hardware/tools/arm/bin/arm-none-eabi-g++ -c -O -g -Wall -ffunction-sections -fdata-sections -MMD -nostdlib -fno-exceptions -felide-constructors -std=gnu++0x -fno-rtti -mthumb -mcpu=cortex-m4 -D__MK20DX256__ -DTEENSYDUINO=123 -DARDUINO=10604 -DF_CPU=96000000 -DARDUINO_ARCH_AVR -DUSB_SERIAL -DLAYOUT_US_ENGLISH -IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3 -IC:\Program Files (x86)\Arduino\libraries\SmartMatrix_32x32 -IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire -IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI -IC:\Program Files (x86)\Arduino\libraries\SdFat -IC:\Program Files (x86)\Arduino\libraries\FastLED C:\Users\<MyUserName>\AppData\Local\Temp\build1576159909913431304.tmp\Test.cpp -o C:\Users\<MyUserName>\AppData\Local\Temp\build1576159909913431304.tmp\Test.cpp.o

Then the next step is that you show in detail the changes you made. You can also do a web search if this is a known compiler error. There might already be a patch or a workaround.


Private class-variables from (compiles):

** bool a[34][34];** ** bool b[34][34]; **

To (does not compile):

__ bool* a;__ __ bool* b;__

Edit: Well, I forgot to make two "*", since it is an 2d-array. But why doesn't the compiler gives me an error?


__ bool** a;__ __ bool** b;__

You also need to provide code that shows how the member variables a and b are used.

Do you know how a vector or matrix is layed out in memory?

"bool*" if read out is "a pointer to a pointer to a boolean value". "bool" is "a pointer to a boolean value". "bool" is not a bit. The compile cannot know that the pointer is to a matrix of boolean values.

Or did you translate the code to a pointer to a vector of pointers to vectors of boolean values?

For more details please see


Do you know how a vector or matrix is layed out in memory?


I use memory functions like "memcpy", "memset" and"free" as well as "malloc" and normal array access "[][]".

Using just one "*" should give no compiler error, since it is a semantic error, right?

But why does the compiler freeze then?