The following function is in the file ui_opts.h:

class winui_ui_options
{
	std::map<std::string, std::string> m_list;
	const char *m_filename;

	void create_index(std::ifstream &fp)
	{
		if (!fp.good())
			return;
		bool is_ready = false;
		std::string file_line;
		std::getline(fp, file_line);
		while (fp.good())
		{
			if (is_ready)
			{
				char *s = (char *) malloc(file_line.length()+1);
				strcpy(s, file_line.c_str());

				const char* name = strtok(s, "\t");  // get adjustment name
				char* data = strtok(NULL, "\t");    // get next part (there's no next tab, so just return whatever is left)
				if (name)
					m_list[name] = data ? data : "";
			}
			else
			{
				if (file_line == "$start")
					is_ready = true;
			}

			std::getline(fp, file_line);
		}

		fp.close();
		return;
	}

	bool ends_with_filter(const std::string &str)
	{
		string ending = "_filters";
		u8 endl = ending.length();
		u8 strl = str.length();
		if (strl < endl)
			return false;
		return str.compare(strl - endl, endl, ending) == 0;
	}

public:
	// construction/destruction
	winui_ui_options()
	{
		// set up default values
		for (int i = 0; option_entries[i].name != "$end"; i++)
			m_list[option_entries[i].name] = option_entries[i].value;
		//printf("*** START DUMP OF DEFAULT ***\n");
		//for (auto const &it : m_list)
		//	printf("%s = %s\n", it.first.c_str(), it.second.c_str());
		//printf("*** END DUMP OF DEFAULT ***\n");
	}

	void load_file(const char *filename)
	{
		if (!m_filename)
			m_filename = filename;
		std::ifstream infile (filename);
		create_index(infile);
	}

	void save_file(const char *filename)
	{
		if (!filename)
			return;
		std::string inistring = std::string("\nYOU CAN SAFELY DELETE THIS FILE TO RESET THE EMULATOR BACK TO DEFAULTS.\n\n$start\n");
		for (auto const &it : m_list)
			inistring.append(it.first).append("\t").append(it.second).append("\n");

		std::ofstream outfile (filename, std::ios::out | std::ios::trunc);
		size_t size = inistring.size();
		char *t1 = (char *) malloc(size+1);
		strcpy(t1, inistring.c_str());
		outfile.write(t1, size);
		outfile.close();
		return;
	}

	void reset_and_save(const char *filename)
	{
		// set up default values
		for (int i = 0; option_entries[i].name != "$end"; i++)
			m_list[option_entries[i].name] = option_entries[i].value;

		save_file(filename);
	}

	void setter(const char* name, std::string value)
	{
		m_list[name] = value;
		save_file(m_filename);
	}

	// cannot be "setter" otherwise most strings use it, causing "1" to be saved.
	//void bool_setter(const char* name, bool value)
	//{
	//	m_list[name] = value ? "1" : "0";
	//	save_file(m_filename);
	//}

	void setter(const char* name, int value)
	{
		u8 s_write = 3;
		// filters: only want an entry if a filter is applied
		if (ends_with_filter(name))
		{
			if (value == 0)
			{
				if (m_list.find(name) == m_list.end())
					s_write = 0; // there is no entry so do nothing
				else
					s_write = 2; // delete the existing entry
			}
		}
		if (s_write)
		{
			if (s_write == 2)
				m_list.erase(m_list.find(name)); // delete
			else
				m_list[name] = std::to_string(value); // add or update

			save_file(m_filename);
		}
	}

	std::string getter(const char* name)
	{
		if (m_list.count(name))
			return m_list.find(name)->second;
		else
			return "";
	}

	int int_value(const char* name)
	{
		string t = getter(name);
		if (t.empty())
			return 0;
		else
			return std::atoll(t.c_str());
	}

	bool bool_value(const char* name)
	{
		return int_value(name) ? 1 : 0;
	}
};


If i include the file (#include "ui_opts.h") to treeview.cpp i get this errors:

D:/mingw/mame/src/osd/winui/ui_opts.h: In member function 'void winui_ui_options::create_index(std::ifstream&)':
D:/mingw/mame/src/osd/winui/ui_opts.h:213:8: error: invalid use of incomplete type 'std::ifstream' {aka 'class std::basic_ifstream<char>'}
  213 |   if (!fp.good())
      |        ^~
In file included from d:/mingw/mingw64-w32/mingw32/include/c++/10.3.0/memory:74,
                 from D:/mingw/mame/src/emu/emu.h:27,
                 from D:/mingw/mame/src/osd/winui/winui.h:26,
                 from ../../../../../src/osd/winui/treeview.cpp:7:
d:/mingw/mingw64-w32/mingw32/include/c++/10.3.0/iosfwd:116:11: note: declaration of 'std::ifstream' {aka 'class std::basic_ifstream<char>'}
  116 |     class basic_ifstream;
      |           ^~~~~~~~~~~~~~
In file included from ../../../../../src/osd/winui/treeview.cpp:9:
D:/mingw/mame/src/osd/winui/ui_opts.h:217:29: error: no matching function for call to 'getline(std::ifstream&, std::string&)'
  217 |   std::getline(fp, file_line);
      |                             ^
In file included from d:/mingw/mingw64-w32/mingw32/include/c++/10.3.0/string:56,
                 from d:/mingw/mingw64-w32/mingw32/include/c++/10.3.0/bits/locale_classes.h:40,
                 from d:/mingw/mingw64-w32/mingw32/include/c++/10.3.0/bits/ios_base.h:41,
                 from d:/mingw/mingw64-w32/mingw32/include/c++/10.3.0/ios:42,
                 from D:/mingw/mame/src/lib/util/vecstream.h:24,
                 from D:/mingw/mame/src/lib/util/coretmpl.h:16,
                 from D:/mingw/mame/src/emu/emucore.h:27,
                 from D:/mingw/mame/src/emu/emu.h:33,
                 from D:/mingw/mame/src/osd/winui/winui.h:26,
                 from ../../../../../src/osd/winui/treeview.cpp:7:
.
.
.

What is wrong?