There are two classes:
class ChangeButton { public: ChangeButton(string ButtonCode, int ButtonType) { btn_code = ButtonCode; btn_type = ButtonType; } std::string get_btn_code() { return btn_code; } int get_btn_type() { return btn_type; } private: std::string btn_code; int btn_type; }; class Change { public: Change(list<ChangeButton> Change_Button, list<ChangeButton> Change_To_Button) { change_btn_list = Change_Button; change_to_btn_list = Change_To_Button; } list<ChangeButton> get_list_change_btn() { return change_btn_list; } list<ChangeButton> get_list_change_to_btn() { return change_to_btn_list; } private: list<ChangeButton> change_btn_list; list<ChangeButton> change_to_btn_list; }; In the code I need:
list<Change> Changes; list<ChangeButton> ChangeButtons; list<ChangeButton> ChangeToButtons; When compiling a project, numerous errors pop up like: Change an undeclared identifier, a symbol is neither a template class, nor a function template, etc.
I am new to C ++, so I’m doing something like C #.
What is my mistake, please tell me. I would be grateful if you show an example.
// JsonReader.cpp: определяет точку входа для консольного приложения. // #include "stdafx.h" #include "rapidjson/document.h" #include "rapidjson/writer.h" #include "rapidjson/stringbuffer.h" #include "rapidjson/istreamwrapper.h" #include <iostream> #include <string> #include <fstream> #include <list> using namespace rapidjson; using namespace std; int main() { list<Change> Changes; list<ChangeButton> ChangeButtons; list<ChangeButton> ChangeToButtons; ifstream ifs("json.js"); IStreamWrapper isw(ifs); Document documentFromFile; documentFromFile.ParseStream(isw); Value& arr = documentFromFile["changes"]; // open the "changes" tag if (arr.IsArray()) { for (SizeType i = 0; i < arr.Size(); i++) // foreach the "changes" tag { Value& changes = arr[i]; Value& change_btns = changes["change_btns"]; if (change_btns.IsArray()) { for (SizeType i = 0; i < change_btns.Size(); i++) // { Value& btn = arr[i]; cout << btn.GetType() << '\n'; } } } } system("pause"); return 0; } class ChangeButton { public: ChangeButton(string ButtonCode, int ButtonType) { btn_code = ButtonCode; btn_type = ButtonType; } std::string get_btn_code() { return btn_code; } int get_btn_type() { return btn_type; } private: std::string btn_code; int btn_type; }; class Change { public: Change(list<ChangeButton> Change_Button, list<ChangeButton> Change_To_Button) { change_btn_list = Change_Button; change_to_btn_list = Change_To_Button; } list<ChangeButton> get_list_change_btn() { return change_btn_list; } list<ChangeButton> get_list_change_to_btn() { return change_to_btn_list; } private: list<ChangeButton> change_btn_list; list<ChangeButton> change_to_btn_list; };
#include <list>,#include <string>,using std::list,using std::string- academainfunction is defined - acade