|
-
April 9th, 2013, 07:06 AM
#18
Re: Can't intialize C++ Struct with CString in it??
Victor and Igor
Also created a console app w\MFC support and copied the initialization section of Igor's program:
#define COUNTOF(x) (sizeof(x)/sizeof(x[0]))
struct print
{
int x; //row
int y; //col
int fid;
CString sData;
char *chData;
};
CString temp("Address");
struct print form [] =
{
{ 30, 40, 1,CString("Name"), "N/A" },
{ 30, 42, 1, temp , "N/A" },
{ 30, 44, 1, temp, "N/A" },
{ 30, 50, 1, temp, "N/A" },
};
got the following error messages for each line of the struct member intialization code:
error C2440: 'initializing' : cannot convert from 'const int' to 'struct print'
No constructor could take the source type, or constructor overload resolution was ambiguous
Rate this post if it helped you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|