c++ - 'Input' does not name a type error. Can't figure out why? -
when compile, error: 'input' not name type on line 17
#ifndef game_h #define game_h #include "input.h" // can forward declare "class input(glfwwindow*);" here still // gives same error. class game { public: game(input* input); ~game(); void input(); void update(); void render(); private: input* mpinput; //error here. }; #endif // game_h
input.h looks this.
#ifndef input_h #define input_h #include <glfw/glfw3.h> #include <vector> class input { public: input(glfwwindow* window); ~input(); bool getkey(int keycode); bool getkeydown(int keycode); bool getkeyup(int keycode); void update(); private: glfwwindow* mpwindow; std::vector<bool> mcurrentkeys; std::vector<bool> mdownkeys; std::vector<bool> mupkeys; const int num_keycodes = 256; }; #endif // input_h
i have no clue going on here. had similar problem yesterday, , couldn't figure out, tried saving project, closing code::blocks, restarting code::blocks, , reopening project. compiled , worked no apparent reason. no code changed or anything. tried reloading project here too, still gives same error.
you have method input
in class code. mixing names of methods , types bad idea. consider code in 1 of class game
methods:
input();
is method input
call or trying create input
class instance? try renaming input
method.
Comments
Post a Comment