Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef PINF_OPTS_H
- #define PINF_OPTS_H
- #endif //PINF_OPTS_H
- struct _optL {
- struct opt avOpt[];
- } optL;
- struct _opt {
- char *option; // e.g. --group
- char *alias; // e.g. -G
- int reqArg; // Require Argument | 0: No 1: Yes
- int maxArgs; // -1: Undefined/ Unlimited
- int func; /* Run Function? 0: No 1: Yes
- * If No, it can be checked with function 'isOptEnabled'
- */
- } opt;
- struct _acOpt {
- struct opt *acOpt[];
- } acOpt;
- // == FUNC ==
- void initOpts(void);
- #include "opts.h"
- #include <stdio.h>
- #include <stdlib.h>
- // == VAR ==
- static struct optL *optList;
- static struct acOpt *activeOpts;
- // == CODE ==
- void initOpt(void) {
- optList = (struct optL *)malloc(sizeof(struct optL *));
- activeOpts = (struct acOpt *)malloc(sizeof(struct acOpt *));
- }
- #include <stdio.h>
- #include "../include/opts.h"
- int main(void) {
- initOpts();
- return 0;
- }
- In file included from include/opts.c:5:0:
- include/opts.h:14:16: error: array type has incomplete element type ‘struct opt’
- struct opt avOpt[];
- ^~~~~
- include/opts.h:28:17: error: flexible array member in a struct with no named members
- struct opt *acOpt[];
- ^~~~~
Add Comment
Please, Sign In to add comment