I'm trying to port some of my Arduino code to Maple and I'm running into some problems. This time it looks like a bug.
I've got these includes
#include <stdlib.h>
#include <string>
#include <sstream>
#include <Wire.h> //I2C library
#include <I2C_eeprom.h>
#include <TinyGPS.h>
#include <track.h>
And a function using std::string like this:
//Pad the incoming long with 0 to length
std::string pad(long num, int length) {
std::string number;
std::stringstream strstream;
strstream << num;
strstream >> number;
int str_length = number.length();
for (int i = 0; i < length - str_length; i++)
number = "0" + number;
return number;
}
This should all work, were it not that the cpp file generated (by the IDE, I suppose) is missing the std:: namespace for the function declaration. The code generated looks like this:
#include <stdlib.h>
#include <string>
#include <sstream>
#include <Wire.h> //I2C library
#include <I2C_eeprom.h>
#include <TinyGPS.h>
#include <track.h>
#include "WProgram.h"
void setup();
void loop();
string pad(long num, int length);
Obviously, omitting the std:: namespace will not work. Is there a quick workaround for this? I tried to manually declare everything, hoping that the IDE would pick that up and not try to do it itself...