Why can’t you grab tickets when you travel on holiday?Reveal the key technology of 12306 how to ensure the ticket is not oversold>>>
The following error occurred when converting C language to C + + code
sorry, unimplemented: non-trivial designated initializers not supported。
The reason is that when initializing C + + structure, it must be initialized according to the defined order. It is not possible to initialize other options by skipping its contents, or there is a problem with the defined order
eg:
typedef struct command
{
int a;
char *b;
int c;
int d;
};
In the C language, it can be initialized when it is defined
struct command cmd = {
.a = 20,
.c = 3,
};
In C + + language, errors will be reported. The modification method is as follows:
struct command cmd = {
.a = 20,
. B = ‘,// must be initialized
.c = 3,
};
There is also a problem of order. The definition in C + + must be consistent with that in struct
eg:
struct command cmd = {
.b = “fff”,
.a = 3,
};
C runs normally, while C + + runs abnormally, it will report title error and modify
struct command cmd = {
.a = 3,
.b = “fff”,
};
Similar Posts:
- About the compilation error “dereferencing pointer to incomplete type
- [How to Solve] dereferencing pointer to incomplete type
- [Solved] expected specifier-qualifier-list before sth
- Invalid use of incomplete type struct or class solution
- Warning: will be initialized after [- writer]
- OO ALV: How to realize red box positioning of field error
- C1189 #error: “No Target Architecture”
- Error: expected identifier before numeric constant [Solved]
- No r interpreter defined appears under pychar
- [Solved] error: aggregate value used where an integer was expected