rmc/rmc.h:18: error: ISO C++ forbids declaration of `rules' with no type
Code:
#ifndef _RMC_H
#define _RMC_H
#include <cstdio>
#include <string>
#include <vector>
class RMC {
std::vector <std::string> rules;
rules.push_back("This is a string");
};
#endif /* _RMC_H */
I have worked on this for a while. It works when I put it in the main() function, but never in classes. Why? Any help sure is appreciated!
Re: rmc/rmc.h:18: error: ISO C++ forbids declaration of `rules' with no type
This statement should be placed in a function:
Code:
rules.push_back("This is a string");
It does not belong in a class definition (unless it is within a function) because it is not some declaration of a member variable, member function, etc.