i want to move the init function in an other file but the gWindow and gRenderer make a problem
To be clear: you have a separate source file with your init() function, and the problem is that it can't see the global variables in main.cpp (gWindow, gRenderer, etc)?
In the same file as init(), somewhere before it:
extern SDL_Window* gWindow;
extern SDL_Renderer* gRenderer;
extern Mix_Music *gMusic;
This tells the compiler that these variables exist somewhere, so it's okay to use them. The linker will figure out where to find them when building the final executable.
(Ideally, this goes in a header and not at the top of a source file, so there's one copy of this information that various source files can share, so when this list of variables change, you only have to update one place. But you still need the non-extern lines in main.cpp. One's a declaration, the other is a definition, and the difference is important. One is a note in the card catalog, the other is the actual book on the shelf.)
(Also, if this wasn't what you were asking, I apologize in advance!)