I am only in the beginning steps of this program but I like to compile as I am making code. Also I am very new with ADTs so when making this code I ran into some problems that I have no idea what they mean.
Expression.h
#include "header.h" //Library that contains thing like iomanip, cstring, etc.
class Expression
{
private:
char *ieEXP; //Array of characters
char *peEXP; //Array of characters
const int MAX = 40; //Max size for the array
public:
//Initialize both arrays to 0
Expression(){ieEXP[MAX] = {0}, peEXP[MAX] = {0}};
Expression(const Expression &);
//Destroy contents within the array after program completes
~Expression(){ieEXP[MAX] = {0}, peEXP[MAX] = {0}};
//void ReadInFix(char *ieEXP);
//void PrintInFix(char *ieEXP);
//void StrCatch();
//bool IsOperator();
//void IntoPostFix(char *peEXP);
//void PrintPostFix(char *peEXP);
//int Priority();
};
Compilation
g++ -c Expression.h
This is the exact error that I get
Expression.h:1: error: expected constructor, destructor,
or type conversion before string constant
Also other methods have not been used yet simply just creating the class right now, and int main has not called anything yet.
Thank you.
The solution is probably to not compile a header file, as g++ doesn’t recognize *.h as a source file. You probably want to create a .cpp file that includes your header, and compile that. g++ will recognize the .cpp and treat it properly.