Compiler error c2552 non-aggregates cannot be initialized with initializer list

Source: Internet
Author: User

Compiler error c2552 non-aggregates cannot be initialized with initializer list. This error beacuse of the following .....

The specified identifier was incorrectly initialized.

An initializer list is needed to initialize the following types:

1) An Array
2) A class, structure, or union that does not have constructors, private or protected members, base classes, or virtual functions
These types are known as "aggregates ."

Sample Code ....

 

Code
// CLR. cpp: Main project file.

# Include "stdafx. H"
# DEFINE _ afxdll
# Include "afx. H"
# Include <strsafe. h>
# Include <iostream>
Using namespace STD;
Using namespace system;
Using namespace system: diagnostics;

Typedef struct _ myoverlapped: Public overlapped {
Int I;
} Myoverlapped, * pmyoverlapped;

Int main (array <system: String ^> ^ ARGs ){
Myoverlapped my = {0}; // my has base class, so this line will generate compiler error c2552
Cout <my. I <Endl;

System ("pause ");
Return 0;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.