I keep receiving a long string of errors when I try to declare a vector in the header. I've looked around for awhile, but can't find a solution.
Here are the errors:
1>Compiling... 1>game.cpp 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C2143: syntax error : missing ';' before '<' 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C2071: 'input::vector' : illegal storage class 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C2238: unexpected token(s) preceding ';' 1>main.cpp 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C2143: syntax error : missing ';' before '<' 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C2071: 'input::vector' : illegal storage class 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C2238: unexpected token(s) preceding ';' 1>input.cpp 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C2143: syntax error : missing ';' before '<' 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C2071: 'input::vector' : illegal storage class 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\legacyblade\documents\visual studio 2008\projects\fourswords\fourswords\input.h(38) : error C2238: unexpected token(s) preceding ';'
Here is the source code:
#include <vector>
#include <SFML/Graphics.hpp>
#ifndef _input_h
#define _input_h
class input
{
public:
input();
void update();
//----input keys----//
// Directions
bool upPress;
bool downPress;
bool leftPress;
bool rightPress;
// Actions
bool aPress;
bool bPress;
bool jumpPress;
bool shieldPress;
// Menu
bool startPress;
bool screenshotPress;
bool fullscreenPress;
//------------------//
private:
extern vector<sf::Keyboard::Key> keyBindings;
};
#endif
It gives me the same error with and without extern, and even if I change the type of thing inside the vector (even int).
Thank you so much for reading. It would be great if anyone could help. I need vectors to do what I'm wanting to do. Don't know why it's giving me such trouble. Any other type of variable in the same spot DOES NOT cause the error. Only vectors.