I'm using c++11 restrictions, so I can beef up on C++, haha snicker snicker, Just want to try and make a good program in C++. (first timer, i must add)
code to reproduse the errors.
main
Code:
#include <iostream>
#include "strt.h"
int main(){
options opts;
return 0;
}
a header file.
Code:
#ifndef STRT_H
#define STRT_H
#include <vector>
typedef struct {
int i = 0;
int g = 0;
//to be compatible with vector.size() return data type
unsigned long int leftoff = 0;
char *path = NULL;
//holds file names
std::vector<std::string> dfile;
}options;
extern options opts;
#endif
the two things I do not know what about.
the errors,
Code:
[userx@void stupid]$ g++ -Weffc++ *.cpp
In file included from dummy.cpp:2:0:
strt.h: In constructor 'options::options()':
strt.h:18:2: warning: 'options::dfile' should be initialized in the member initialization list [-Weffc++]
}options;
^~~~~~~
dummy.cpp: In function 'int main()':
dummy.cpp:5:10: note: synthesized method 'options::options()' first required here
options opts;
^~~~
I do not know how to fix either one. never heard tell of that synthesized method thing. Until I googled it and it looks like it gets called for all sorts of things.
initialize a vector<string> ?