energia / msp430-lg-core

15 stars 12 forks source link

MSP430F5529 : undefined reference to `operator new[](unsigned int)' #15

Closed rei-vilo closed 7 years ago

rei-vilo commented 8 years ago

Using new against the MSP430F5529 raises an error.

undefined reference to `operator new[](unsigned int)'

Maybe energia/msp430-ng-core will support it?

Cross posted with https://github.com/energia/msp430-ng-core/issues/2

robertinant commented 8 years ago

Can you please provide an example Sketch that shows the error?

rei-vilo commented 8 years ago
uint8_t * pointer;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

  uint8_t * table = new uint8_t[16];
  pointer = (uint8_t *) table;

  pointer [1] = 1;
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.print(pointer[1], DEC);
  while (1);
}

Compiles and run on TM4C but fails on MSP430F5529.

robertinant commented 8 years ago

mspgcc does not have full support for C++. For example, there is no libstdc++. The new compiler soon to be featured in Energia will have more extensive support for C++.

rei-vilo commented 7 years ago

For the moment, the only turn-around is to define the arrays directly as variable without using new().

rei-vilo commented 7 years ago

@robertinant Any update on the switch to the new compiler?

RickKimball commented 7 years ago

fixed with: https://github.com/energia/msp430-lg-core/commit/9b6fc95750b87eed164907902bfa23be29c01576