How to fix the error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to fix the error?

DevC++ I wrote the code #include "SDL2/SDL.h" #define int SDL_main(int argc, char **args) { // START SDL // Quit SDL return 0; } Compilation and here an error 1) Error cannot file - ISDLmain cannot file -ISDL 2) Makefile.win $(BIN) : $(OBJ) $(CPP) $(LINKOBJ) - o (BIN) $(LIBS)

6th Sep 2019, 11:11 AM
Ахан
Ахан - avatar
12 Answers
6th Sep 2019, 11:35 AM
Duck Typed
Duck Typed - avatar
+ 1
SDL main should have parameters int and char** I believe. Also, it might be so that your SDL_main should be renamed to main. I worked with version 2.
6th Sep 2019, 11:13 AM
Duck Typed
Duck Typed - avatar
0
Duck Typed I wrote the parameters, it does not work, I also have version 2.0
6th Sep 2019, 11:17 AM
Ахан
Ахан - avatar
0
Duck Typed In terminal : undefined reference to 'WinMan' Error id returned 1 exit status
6th Sep 2019, 11:24 AM
Ахан
Ахан - avatar
0
Did you try renaming SDL_main to main? Also, Lazy Foo productions on Google has a good tutorial on setting up SDL, build settings included.
6th Sep 2019, 11:30 AM
Duck Typed
Duck Typed - avatar
0
Duck Typed No I just wrote SDL_main
6th Sep 2019, 11:33 AM
Ахан
Ахан - avatar
0
Duck Typed link please?
6th Sep 2019, 11:34 AM
Ахан
Ахан - avatar
0
The problem has not been resolved yet. Well, if there are options, tell
6th Sep 2019, 12:00 PM
Ахан
Ахан - avatar
0
1. Change SDL_main to int main(int argc, char **argv) 2. If you're using SDL2 try the linker flag -lSDL2 Tell me if this sample code is working for you: #include "SDL2/SDL.h" #include <stdio.h> int main(int argc, char **argv) { if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { fprintf(stderr, "Failed to initialize SDL.\n"); return 1; } else { printf("Successfully initialized SDL.\n"); } SDL_Quit(); return 0; }
6th Sep 2019, 7:54 PM
Cluck'n'Coder
Cluck'n'Coder - avatar
0
Cluck'n'Coder In terminal : undefined reference to 'WinMan' Error id returned 1 exit status
6th Sep 2019, 8:44 PM
Ахан
Ахан - avatar
0
Cluck'n'Coder not working
6th Sep 2019, 8:46 PM
Ахан
Ахан - avatar
0
Cluck'n'Coder as you said did everything
6th Sep 2019, 8:47 PM
Ахан
Ахан - avatar