First of all: it is some old code to be executed on some old machines, thus I'm forced to use the ancient Visual Studio 6 and can't simply update to a newer compiler. My problem: I have an array of a structure and try to statically initialize it. This works well with all modern compilers but VC6 complains for every member it is not compatible with the struct
type.
The struct
is defined as
struct instData
{
char m_IP[MAX_IP_LENGTH];
unsigned short m_mode;
int m_sock;
double m_prev;
};
Static initialization looks like:
static struct instData data[MAX_HEAD_NUM+1]={
{"",0,0,0.0},
{"",0,0,0.0},
...
The error messages I get are:
error C2440: 'initializing' : cannot convert from 'char [1]' to 'struct instData'
No constructor could take the source type, or constructor overload resolution was ambiguous
error C2440: 'initializing' : cannot convert from 'const int' to 'struct instData'
No constructor could take the source type, or constructor overload resolution was ambiguous
error C2440: 'initializing' : cannot convert from 'const int' to 'struct instData'
No constructor could take the source type, or constructor overload resolution was ambiguous
error C2440: 'initializing' : cannot convert from 'const double' to 'struct instData'
No constructor could take the source type, or constructor overload resolution was ambiguous
Means it complains for every member of the struct and all in first initialisation-line. So does anybody remember how such an initialisation should look like to work with VC6?