I'm writing the header file for a class that communicates with an Arduino, and I keep getting the above error message. I looked at other similar questions, and a reoccuring problem is that the data type in question is not well-defined. Is there any reason why std::string isn't defined, or is there another issue? Thanks in advance!
Edit: The following code is for the Linux Machine I'm using to communicate with the Arduino, and therefore isn't the Arduino code. Also the full error message is: error: expected ‘)’ before ‘name’ ArduinoCom(std::string name, speed_t baud);
#ifndef ArduinoCom
#define ArduinoCom
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
#include <iostream>
#include <fstream>
#include <string>
#include <termios.h>
#include "SerialCom.h"
class ArduinoCom {
public:
ArduinoCom(std::string name, speed_t baud);
~ArduinoCom();
std::string get_value(std::string value_type);
double get_double_value(std::string value_type);
private:
SerialCom *ard_serial;
};
#endif
And the corresponding .cpp file:
#include "ArduinoCom.h"
#include "SerialCom.h"
using namespace std;
ArduinoCom::ArduinoCom(std::string name, speed_t baud){
ard_serial = new SerialCom(name, baud);
}
ArduinoCom::~ArduinoCom(){
delete ard_serial;
}
std::string ArduinoCom::get_value(std::string value_type){
ard_serial->write(value_type);
std::string buf;
ard_serial->read(buf);
return buf;
}
double ArduinoCom::get_double_value(std::string value_type){
std::value_str = ArduinoCom::get_value(value_type);
return stod(value_str);
}