S
Saurabh Aggrawal
Hi,
On line nos. 24, 25, 26
24: wstring cfMethods[] = {{L"setLabel"},{L""}};
25: wstring cfProperties[]= {{L"isVisible"},{L""}};
26: wstring cfEvents[] =
{{L"onLoad"},{L"onQueryTerminate"},{L"onTerminate"},{L""}};
i am getting the following errors:
cframe.cpp(24) : error C2552: 'cfMethods' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(24) : error C2552: 'cfMethods' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(25) : error C2552: 'cfProperties' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(25) : error C2552: 'cfProperties' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(26) : error C2552: 'cfEvents' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(26) : error C2552: 'cfEvents' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(26) : error C2552: 'cfEvents' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(26) : error C2552: 'cfEvents' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
This compiler error is due to the reason:
// initialize a CLR immutable value type that has a constructor
System:ateTime dt = {2001, 4, 12, 22, 16, 49, 844}; // C2552
Question 1. How should i initialize an array of wstring?
Question 2. And what is wrong with the statement below.
wstring cfMethods[] = {{L"setLabel"},{L""}};
Respects,
Saurabh Aggrawal
On line nos. 24, 25, 26
24: wstring cfMethods[] = {{L"setLabel"},{L""}};
25: wstring cfProperties[]= {{L"isVisible"},{L""}};
26: wstring cfEvents[] =
{{L"onLoad"},{L"onQueryTerminate"},{L"onTerminate"},{L""}};
i am getting the following errors:
cframe.cpp(24) : error C2552: 'cfMethods' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(24) : error C2552: 'cfMethods' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(25) : error C2552: 'cfProperties' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(25) : error C2552: 'cfProperties' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(26) : error C2552: 'cfEvents' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(26) : error C2552: 'cfEvents' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(26) : error C2552: 'cfEvents' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
cframe.cpp(26) : error C2552: 'cfEvents' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]
This compiler error is due to the reason:
// initialize a CLR immutable value type that has a constructor
System:ateTime dt = {2001, 4, 12, 22, 16, 49, 844}; // C2552
Question 1. How should i initialize an array of wstring?
Question 2. And what is wrong with the statement below.
wstring cfMethods[] = {{L"setLabel"},{L""}};
Respects,
Saurabh Aggrawal