I had an error of already declared
because I declared the same variable at two files, So I did like this:
open_gl.h
#ifndef _OPEN_GL_H_
#define _OPEN_GL_H_
#define SCREEN_SIZE 500
#define SCREEN_POINT 0.7
int position;
extern int openGl(int *argc, char *argv[]);
extern void navigate(const char *routeName);
#endif // !OPEN_GL
and I'm trying to use the position
variable in other files.
but I get this error:
Severity Code Description Project File Line Suppression State Error LNK2005 "int position" (?position@@3HA) already defined in login.obj sudoku C:\Users\nati3\source\repos\sudoku\sudoku\registerPage.obj 1
when I remove the declaration from the header file I get:
Severity Code Description Project File Line Suppression State Error C2065 'position': undeclared identifier sudoku c:\users\nati3\source\repos\sudoku\sudoku\login.cpp 8
and other errors about other files that it wasn't declared.
How can I fix it?