TCP-UDP-Proxy icon indicating copy to clipboard operation
TCP-UDP-Proxy copied to clipboard

Problem Building in Visual Studio Pro 2019

Open mackbw opened this issue 4 years ago • 0 comments

I've been trying to compile TCP-UDP-Proxy for Windows, ultimately Windows 10, but at the moment I'm trying to compile on my Windows 7 VM. I am using Visual Studio Pro 2019. After trying the latest version (1.75.0) of the Boost Library with some errors due to some deprecated members, I bounced around older versions until finding that Version 1.68.0 reduced my compile errors substantially, and of those 20 or so errors, are caused by some typedef problems in fstream.hpp. (I could be wrong, but the errors all seem to be related to fstream_fix.)

Specifically, I get the following errors to begin with:

'fstream_fix<std::basic_ifstream<char,std::char_traits<char> > >' is not a variable template
'fstream_fix<std::basic_ofstream<char,std::char_traits<char> > >' is not a variable template

This comes from the following lines in the fstream.hpp from boost

typedef basic_ifstream<char> ifstream;  
typedef basic_ofstream<char> ofstream;

Where ifstream and ofstream are indicated as being redefined in the project's xfstream.h as

#define ifstream fstream_fix<std::ifstream>
#define ofstream fstream_fix<std::ofstream>

With the definition of fstream_fix in xfstream.h as

template<class T>
struct fstream_fix
	: public T
{
	fstream_fix(){};

	template<class T1>
	fstream_fix(T1 v1){
		setlocale(LC_CTYPE, "");
		T::open(v1);
		setlocale(LC_CTYPE, 0);
	}

	template<class T1,class T2>
	fstream_fix(T1 v1,T2 v2){
		setlocale(LC_CTYPE, "");
		T::open(v1,v2);
		setlocale(LC_CTYPE, 0);
	}


	template<class T1>
	void open(T1 v1){
		setlocale(LC_CTYPE, "");
		T::open(v1);
		setlocale(LC_CTYPE, 0);
	}

	template<class T1,class T2>
	void open(T1 v1,T2 v2){
		setlocale(LC_CTYPE, "");
		T::open(v1,v2);
		setlocale(LC_CTYPE, 0);
	}
};

So I'm wondering if this is a newer/different compiler issue? Or the application itself? Or maybe just missing something like the ifstream and ofstream in fstream.hpp should be set to the std namespace. Although I tried to declare those identifiers directly, and that did not help.

Hope we can get this cleaned up.

Thanks, Mack

mackbw avatar Feb 22 '21 15:02 mackbw