hadrienlearn
New Coder
Hello
I post this because I have some problem with my var
my code look like this
When I compile it.
C:\Users\boite\OneDrive\Bureau\Nouveau dossier (2)\Nouveau Projecr>gcc src/main.c -o bin/prog -I include -L lib -lmingw32 -lSDL2main -lSDL2
src/main.c: In function 'SDL_main':
src/main.c:14:17: error: 'app' undeclared (first use in this function); did you mean 'App'?
14 | memset(&app, 0, sizeof(App));
| ^~~
| App
src/main.c:14:17: note: each undeclared identifier is reported only once for each function it appears in
src/main.c:16:9: warning: implicit declaration of function 'SDL_InitApplication' [-Wimplicit-function-declaration]
16 | SDL_InitApplication();
| ^~~~~~~~~~~~~~~~~~~
src/main.c: At top level:
src/main.c:21:6: warning: conflicting types for 'SDL_InitApplication'; have 'void(void)'
21 | void SDL_InitApplication(void)
| ^~~~~~~~~~~~~~~~~~~
src/main.c:16:9: note: previous implicit declaration of 'SDL_InitApplication' with type 'void(void)'
16 | SDL_InitApplication();
| ^~~~~~~~~~~~~~~~~~~
src/main.c: In function 'SDL_InitApplication':
src/main.c:24:9: error: 'app' undeclared (first use in this function); did you mean 'App'?
24 | app.window = NULL;
| ^~~
| App
Can Anyone help me ?
I post this because I have some problem with my var
my code look like this
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL.h>
void SDL_InitApplication(void)
typedef struct
{
SDL_Window *window;
SDL_Renderer *renderer;
} App;
int main(int argc, char *argv[])
{
memset(&app, 0, sizeof(App));
SDL_InitApplication();
return 1;
}
void SDL_InitApplication(void)
{
SDL_Init(SDL_INIT_VIDEO);
app.window = NULL;
app.window = SDL_CreateWindow("SDL2", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, 0);
app.renderer = NULL;
app.renderer = SDL_CreateRenderer(app.window, -1, SDL_RENDERER_SOFTWARE);
return;
}
C:\Users\boite\OneDrive\Bureau\Nouveau dossier (2)\Nouveau Projecr>gcc src/main.c -o bin/prog -I include -L lib -lmingw32 -lSDL2main -lSDL2
src/main.c: In function 'SDL_main':
src/main.c:14:17: error: 'app' undeclared (first use in this function); did you mean 'App'?
14 | memset(&app, 0, sizeof(App));
| ^~~
| App
src/main.c:14:17: note: each undeclared identifier is reported only once for each function it appears in
src/main.c:16:9: warning: implicit declaration of function 'SDL_InitApplication' [-Wimplicit-function-declaration]
16 | SDL_InitApplication();
| ^~~~~~~~~~~~~~~~~~~
src/main.c: At top level:
src/main.c:21:6: warning: conflicting types for 'SDL_InitApplication'; have 'void(void)'
21 | void SDL_InitApplication(void)
| ^~~~~~~~~~~~~~~~~~~
src/main.c:16:9: note: previous implicit declaration of 'SDL_InitApplication' with type 'void(void)'
16 | SDL_InitApplication();
| ^~~~~~~~~~~~~~~~~~~
src/main.c: In function 'SDL_InitApplication':
src/main.c:24:9: error: 'app' undeclared (first use in this function); did you mean 'App'?
24 | app.window = NULL;
| ^~~
| App
Can Anyone help me ?