I'm using a LPC2129 and DKARM 1.3 I have something like this //class declaration class SPI { SPI(uint8 init)//contructor .... } //Contructor definition SPI::SPI(uint8 init) { ... } //Object Declaration SPI SPI0(1); The problem is, when I create the object the constructor should be called, what it doesn't happen...
I'm not familiar with the Keil ARM tools, but: If the object is file scope, as you show, then the compiler has to generate code to call the constructors for all such objects before main(). The C++ run-time code will have to call all such constructors after the run-time system and libraries are initialized and before main() starts. So, I'd suggest checking your initialization / board support package code to be sure you call all of the appropriate hooks to initialize the system.