Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years ago.
C++ iostream lib issues
Hi there,
I encounter a compiler error which was once no problem months ago. My code is as follows:
A random blinky test program
//NXP LPC1114 #include "mbed.h" #include <cstdlib> #include <iostream> DigitalOut led(dp14); int main() { //using namespace std; while(1) { led = rand() % 2; //led = 1; wait(0.5); //cout << "Hello World!\n\r" << endl; led = 0; wait(0.5); } }
And those compiling error messages are: Error: No space in execution regions with .ANY selector matching ios.o(.bss). Error: Sections of aggregate size 0x1d30 bytes could not fit into .ANY selector(s).
The same code was compiled successfully months ago, but I got those error messages recently. By commenting out the iostream lib, the code is compiled successfully.
By the way, the iostream lib works fine in FRDM-KL25Z and FRDM-KL46Z boards.
Question relating to:
![](/media/cache/platforms/LPC1114_1_hXXAnmW.jpg.50x50_q85.jpg)
1 Answer
11 years ago.
The optimization settings were changed with the last mbed lib, you can try using one older (I don't get why those optimizers can't optimize for as much speed as possible, but always make sure it fits). The issue now is that it simply doesn't fit. The kL25Z and KL46Z have more memory, so there it fits.
That said, in general it is better not to use IOStream, it uses alot of memory, printf uses way less.