Hi everyone, I'm having some issues with a header file i want to add to my project. Here is the headerfile code.
#pragma once
using namespace System;
class Parser {
public:
Parser();
String^ parse(String^ equ)
{
String^ answer = "answer";
return answer;
}
};
I have #include "parser.h" in both my form.h file (the file that will use the parser class and in my stdafx.h file
Here is the code for my form1.h file
#pragma once
#include "parser.h"
namespace Calc {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System:ata;
using namespace System:rawing;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~Form1()
{
if (components)
{
delete components;
}
}
private:
// Win controls, Icon & Menu
TextBox^ CalcField;
ListBox^ CalcScreen;
array<Button^>^ CalcButtons;
static String^ s_strZero;
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
void InitializeComponent(void){//call to calcEqual_Click}
void CalcEqual_Click(Object^ sender, EventArgs^)
{
String^ strValue = CalcField->Text;
if (strValue->Length != 0)
{
CalcScreen->Items->Add(strValue);
CalcField->Text = s_strZero;
Parser newparser();
CalcScreen->Items->Add(newparser.parse(strValue));
}
}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {}
};
}
The error that I am getting is "left of '.parse' must have class/struct/union"
which happens on the line that says
CalcScreen->Items->Add(newparser.parse(strValue));
Durible Outer Casing to Prevent Fall-Apart
#pragma once
using namespace System;
class Parser {
public:
Parser();
String^ parse(String^ equ)
{
String^ answer = "answer";
return answer;
}
};
I have #include "parser.h" in both my form.h file (the file that will use the parser class and in my stdafx.h file
Here is the code for my form1.h file
#pragma once
#include "parser.h"
namespace Calc {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System:ata;
using namespace System:rawing;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~Form1()
{
if (components)
{
delete components;
}
}
private:
// Win controls, Icon & Menu
TextBox^ CalcField;
ListBox^ CalcScreen;
array<Button^>^ CalcButtons;
static String^ s_strZero;
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
void InitializeComponent(void){//call to calcEqual_Click}
void CalcEqual_Click(Object^ sender, EventArgs^)
{
String^ strValue = CalcField->Text;
if (strValue->Length != 0)
{
CalcScreen->Items->Add(strValue);
CalcField->Text = s_strZero;
Parser newparser();
CalcScreen->Items->Add(newparser.parse(strValue));
}
}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {}
};
}
The error that I am getting is "left of '.parse' must have class/struct/union"
which happens on the line that says
CalcScreen->Items->Add(newparser.parse(strValue));
Durible Outer Casing to Prevent Fall-Apart