i download SDL 2 and tried to install it by watching setup tutorials
i done everything as they said but still nothing work (i tried 10+- different tutorials )
everytime i run the code i got 3 errors:
"undefined refrences to SDL_Init"
"undefined refrences to SDL_Quit"
"undefined refrences to SDL_WinMain@16"
i tried every single one of the 3 options - when i download i had 3 folders:
(1)x86_64-w64-mingw32, (2)x86_64-w64-mingw32, (3) [include, lib, test].
im using Codeblocks
and i wrote on the linker options -lmingw32 -lSDL2main -lSDL2
still not working... :/
i read this : https://wiki.libsdl.org/FAQWindows
maybe my problem related to this somehow?
some with this command maybe? sdl-config --libs
or gcc -o test test.c sdl-config --cflags --libs
i just dont know how to configure this to my compiler
Code::Blocks comes with support for reading .DevPak files of late. This allows for an even more comfortable setup. DevPaks (1.2.8) for SDL, SDL-mixer, and SDL-ttf can be found at http://www.devpaks.org/category.php?category=SDL.
Important: Please do note that the packages at devpaks.org are not original packages created by the SDL team. Be aware that devpaks.org theoretically allows anyone to upload anything under the name SDL. Although I know of no case of malware being distributed over this channel, this is a potential risk you have to be aware of.
you mean that this is a risk only if i distribute some of my programms right?
and this is the only way? anyone who have CodeBlocks have that problem?
i tried it now didnt understand what is it done
i copy the files locations and add it to the linker and compiler and still i got errors
im a beginner in all this stuff if you can please give me more extensive explanation
Somebody clearly didnt read this is on code::blocks (mingw), not on VS.
Somehow, mingw "dislikes" sdl.
Reordering your linker flags is all I can think of.
emmm i didnt find the VC++ DIRECTIORES in CODEBLOCKS
and i just want to install successfully the SDL i dont know nothing about all this images types and stuff....
and i tried to reordering as the first guy say, that didnt work
Tried putting -mwindows with the linker flags?
Edit: "Other Linker Options"
Also your libraries should go under "Linker Libraries", one each line, without -l prefix.
Sorry for the multiple edits, I'm typing from my phone.
ah sorry about that, i did not get the Codeblocks part. but i guess the code should still work and you will still need to do your linking so the principal stays the same as for where to set the settings i have no idea sorry about that.
The problem is, his code is not the issue but his project settings - which means most of your post will be useless in this thread, and you just found yourself writing, uh, "less useful" code.
@op: Can you check the linker's log (it should come together with the compiler's log)?
Can you find "missing -lSDL2main" or similar?
If so, you need to set up the linker's search folder, adding your sdl2 /lib folder.
yep i tried -mwindows + adding every single .lib file, still doesnt work.
this is the pictures if that will help you understand more about my situation http://prntscr.com/581zbt http://prntscr.com/581zn4
** this is more like my old pictures
i add the -mwindows and tried reordering the l flags and i add the .lib to the "Link libraries:"
by the way thank you very much to all of you guys for helping me solving this problem i tried in other forums they just gave up XD
Try using the x86 lib folder. Usually, codeblocks comes with a x86 MinGW. Unless you are sure you have MinGW-w64 installed and configured for codeblocks.
Note: for x64, manually compiling sdl2 may be better, but requires you to find all dependencies, so i'll opt-out as of now since I can't help with that from mobile.
Np, all problems have a solution... Maybe it will just take a different amount of time, but there's solutions
tried 86x its crushs codeblock and destory my program
i noticed that my CodeBlocks install in the x86 program files folder
maybe if i reinstall it in the normal program files folder (x64) it will work?
No, it shouldn't be related.
I'll be probably needing to be on pc to check it out.
If you really want to do something til tomorrow, try installing codeblocks again, but make sure everything is either x86 or x64, without mixing them. This may not be the case, tho.
-- Are the files in x64 folder named lib_.a or _.lib ?
Edit: I gave it a slight eye. i686 folder is for x86, x86_64 is for x64. The other include/lib/bin are for VS (there should be some support from mingw)
still nothing i tried to reinstall codeblocks on x64 and refer the compiler to the right libs (x64)
no results :/
and my files in x64 folder named lib_.a
done it and now it says:
fatal error: winapifamily.h : no such file or directory
by the way, the SDL folder location matter?
because its on the desktop