Simple SDL2 Setup in directory (MinGW, VS Code, Windows)

  Рет қаралды 67,066

HerbGlitch

HerbGlitch

Күн бұрын

The best way to contact me is with Discord: / discord
We set up SDL2 for MinGW on Windows. That is pretty much it.
sdl website: www.libsdl.org/
the sample code: github.com/HerbGlitch/SDL2-Setup

Пікірлер: 286
@fuguety
@fuguety Жыл бұрын
MAY GOD BLESS YOU, YOUR FAMILY, YOUR FUTURE, FRIENDS, DOG, CAT, KIDS, RELATIONSHIP, WORK, COLLEGE, SCHOOL, DRIVING, DRINKS, CODING, PROGRAMMING, ETC.
@herbglitch
@herbglitch Жыл бұрын
Thank you, I really appreciate it :)
@vexmane
@vexmane 2 жыл бұрын
THAT is how you make a tutorial. Simple, clear and most importantly not wasting your time. Thanks a lot.
@morfy2581
@morfy2581 2 жыл бұрын
And what I personally find very important: also explaining little things like what the arguments in the makefile mean.
@CestDuFunk
@CestDuFunk Күн бұрын
After 2 days of watching 20 min videos how to set it up, your tutorial worked in 5 min. Thanks alot
@H4_Hassan
@H4_Hassan 10 ай бұрын
This straight and quick forward tutorial makes my .exe file to compile and run. I spend almost 3 hours on setting up it by watching other tutorials. You got a sub ❤
@herbglitch
@herbglitch 10 ай бұрын
Thank you, I am glad to hear the video helped
@zippycat
@zippycat Ай бұрын
man this tutorial is REALLY straightforward. simple, clean, and straight to the point. no unnescessary fillers, absolute goat
@unstablecoding
@unstablecoding 4 ай бұрын
almost 3 years later and you are still a bloody hero, ive been trying to get sdl to work on windows for a year and tbh i just used wsl until now. Ive watched many tutorials and you my friend have made the best tutorial EVER! Thank you!
@herbglitch
@herbglitch 4 ай бұрын
I'm glad this video helped :) I hope you have a blast using SDL2
@filipesimoes5398
@filipesimoes5398 3 жыл бұрын
Man since a long time I've been trying to setup this library. Thank you, sincerely!
@herbglitch
@herbglitch 3 жыл бұрын
np, I am glad to hear it helped :)
@d_00
@d_00 Жыл бұрын
MY BRO thank you SO MUCH You're the only one that actually helped among dozens of videos. Thank you for putting an end to my sleepless nights. You will forever and truthfully be my C++ savior.
@herbglitch
@herbglitch Жыл бұрын
I am glad this video was helpful. I hope you have a ton of fun programming :)
@barabara9855
@barabara9855 3 жыл бұрын
The first video I watch that actually worked. Thank you
@herbglitch
@herbglitch 3 жыл бұрын
I am glad to hear it is working :)
@theomrt
@theomrt 2 жыл бұрын
The official doc confused me then i found your video and it's take me 5min only to get it work ! Thanks a lot !
@herbglitch
@herbglitch Жыл бұрын
I am glad to hear it worked for you :)
@mikael808
@mikael808 2 жыл бұрын
Thank you so much for the amazing tutorial!!! :)
@epipixc
@epipixc 8 ай бұрын
TYSM BRO I WAS STRUGGLING SO BAD THIS HELPED SO MUCH BRO TYSMMMM
@herbglitch
@herbglitch 7 ай бұрын
I'm glad I was able to help :)
@michaelcastelpoggi1735
@michaelcastelpoggi1735 2 жыл бұрын
Easy to follow. Had mouse properties pop up at first when I ran the example code with "main" but another comment had proposed running ./main.exe instead which worked fine. The issue was that I had a powershell terminal open instead of a cmd terminal. The command "main" in powershell opens mouse properties. You can set a default terminal with Ctrl+Shift+P and search "profile" or just open a new cmd terminal by using the expand arrow next to the new terminal "+" icon
@twondai2642
@twondai2642 2 жыл бұрын
thanks I just had the same issue
@captainpricetf141
@captainpricetf141 23 күн бұрын
no time wasted straight to the point gained a sub man
@JozoLeko
@JozoLeko 2 жыл бұрын
Thanks a lot..., You saved a lot of time for me.
@chinmayshiralkar8489
@chinmayshiralkar8489 3 жыл бұрын
That was the cleanest tutorial i have ever seen.
@herbglitch
@herbglitch 3 жыл бұрын
thank you :)
@user-hz4tc2pf3x
@user-hz4tc2pf3x 3 жыл бұрын
True
@frosty7674
@frosty7674 2 жыл бұрын
Yeh polished with soap... Really helpfull btw I don't make
@lionking3608
@lionking3608 3 жыл бұрын
Bro it works quite well. thank you very much!!
@herbglitch
@herbglitch 3 жыл бұрын
I am glad it works for you :)
@nirmalbajiya3283
@nirmalbajiya3283 Жыл бұрын
thnku thnku bhai luv from India. I wass trying to do this day and night but wasn't able to do it till i found u
@herbglitch
@herbglitch Жыл бұрын
I am glad this video was helpful, I hope you enjoy your time programming :)
@andresospina5706
@andresospina5706 2 жыл бұрын
Excellent video man, keep it up.
@herbglitch
@herbglitch 2 жыл бұрын
thank you :)
@BeesUSA
@BeesUSA 2 жыл бұрын
You're a legend. Thank you.
@polis4027
@polis4027 Жыл бұрын
you are a god man, helping us on college work
@polis4027
@polis4027 Жыл бұрын
come to brazil friend
@fuguety
@fuguety Жыл бұрын
Amazing country
@herbglitch
@herbglitch Жыл бұрын
I appreciate it :). good luck on your college work!
@waltuh198
@waltuh198 Жыл бұрын
Thank you! I couldn't get SDL2 to run and you helped me. (btw it says "SLD test" lol)
@herbglitch
@herbglitch Жыл бұрын
I am glad I could help
@aspirinnil
@aspirinnil 2 жыл бұрын
you saved my life!!! thank you soooo much!
@herbglitch
@herbglitch 2 жыл бұрын
I am glad it helped :)
@uxe_yo9657
@uxe_yo9657 11 ай бұрын
Hello, I did all the steps within the tutorial but I still get the error: "cannot open source file SDL2/SDL.h. Is there something I can do? I added the include paths directly to the cpp configure file and it still doesn't work.
@tymoshh
@tymoshh Ай бұрын
i got the same problem man
@noshinraisa6317
@noshinraisa6317 11 ай бұрын
I keep getting this message "SDL2/SDL.h: No such file or directory". I've only managed to open up the blue window after I copied your code, and I've already set up the C++ configs, but it's just not updating anymore when I change the code. It stays at the blue screen.
@insert0name0here91
@insert0name0here91 2 ай бұрын
change #include to #include"src/include/SDL2/SDL.h" and if you're having a complier error do the same tutorial but with the 64 bit file "x86_64-w64-mingw32" instead of the 32 bit one (only if you're on a 64 bit system use Win+PauseBreak and under "System type" it will tell you)
@nemene8585
@nemene8585 2 жыл бұрын
WOW, that was quick and simple, underrated
@herbglitch
@herbglitch 2 жыл бұрын
Thank you :)
@nouaatw6439
@nouaatw6439 3 жыл бұрын
pls dont stop your vids !
@herbglitch
@herbglitch 3 жыл бұрын
I don't plan to :)
@Sim_excently
@Sim_excently 7 ай бұрын
hey bro I have problem: error: SDL.h: No such file or directoryerror: SDL.h: No such file or directory I using vscode Do the same as the video you instructed help me ! please !
@herbglitch
@herbglitch 7 ай бұрын
If this is an error in vscode (red underlines) you might need to add the include directory to your intellisense. If this is an issue with compiling, please make sure your -Isrc/include is spelled the same way as the folders. if you would like help with either or if smthn else doesn't work, I'm happy to help on discord. my username is herbglitch if you want to dm or my server is discord.gg/eqz5jHSUy4
@insert0name0here91
@insert0name0here91 2 ай бұрын
change #include to #include"src/include/SDL2/SDL.h" and if you're having a complier error do the same tutorial but with the 64 bit file "x86_64-w64-mingw32" instead of the 32 bit one (only if you're on a 64 bit system use Win+PauseBreak and under "System type" it will tell you)
@LeeLee-ci5fy
@LeeLee-ci5fy 2 жыл бұрын
Thanks a lot, it helps me much
@herbglitch
@herbglitch 2 жыл бұрын
I am glad to hear it helped :)
@738simpilot
@738simpilot Жыл бұрын
Please help when on the cmd for the files that I have it says “The system cannot find the path specified”
@_AnimeshNaugai
@_AnimeshNaugai Жыл бұрын
thanks a lot for help. :)
@Phantom-ws2hj
@Phantom-ws2hj 2 жыл бұрын
anyone know how to fix this error? C:\Users\jenje\Projects\TicTacToe\main.cpp:2:9: fatal error: SDL2/SDL.h: No such file or directory 2 | #include | ^~~~~~~~~~~~ compilation terminated theres also popups that say "Makefile entry point not found" and "Make not found"
@PolarTop6260
@PolarTop6260 5 ай бұрын
make was not recognized and stuff and error in the first line of code (#include )
@10gamer64
@10gamer64 2 жыл бұрын
Quick question: What do you do if VSCode says that it cannot find SDL.h? I did everything as in the video. Changing the configs does not fix it.
@priyanshbhardwaj6313
@priyanshbhardwaj6313 2 жыл бұрын
Yess Same question and it also gives this error (identifier "memset" is undefined)
@ashes547
@ashes547 Жыл бұрын
Thank you very much!
@herbglitch
@herbglitch Жыл бұрын
np :)
@eladlavi1997
@eladlavi1997 Ай бұрын
This tutorial/explanation is very similar to few others on KZfaq but none of them shows how to actually run from VS Code, meaning DEBUG my code. When trying to run from VS code, it doesn't compile because of the SDL including method which is different. Please show that!
@Codingforugeek
@Codingforugeek 11 ай бұрын
bro my cd programs not working it shows couldnt find the path
@thanhtung2052
@thanhtung2052 2 жыл бұрын
can u make a tutor video about linking sdl2_mixer to a project ?
@mrglick5050
@mrglick5050 5 ай бұрын
I followed the tutorial and made sure to link the libraries but it still gives me an 'undefined reference to [function name] error' whenever I try to use an SDL function(when I use constants from SDL it works fine).
@herbglitch
@herbglitch 5 ай бұрын
Sorry for responding so late, would you mind hopping on discord and debugging there? My username is herbglitch or my server is discord.gg/eqz5jHSUy4. KZfaq comments are very difficult for me to respond to
@swerami
@swerami 19 күн бұрын
god bless you
@mariof.1941
@mariof.1941 9 ай бұрын
it´s now SDL3, works but the SDL_image wont work.... fatal error: SDL_image.h: No such file or directory
@ricardo1084
@ricardo1084 5 ай бұрын
I have that error, can I still use SDL2 or do I have to delete it and download SDL3
@1..1..1..1H
@1..1..1..1H 7 ай бұрын
Thanks bro
@lynnkuo2418
@lynnkuo2418 Жыл бұрын
This was a great tutorial but when i do it it just always says fatal error: : No such file or directory 2 | #include it can't seem to find the #include, why??? please help me
@herbglitch
@herbglitch Жыл бұрын
If this is an error when you compile (which it sounds like it it), you need to make sure that the path from where you run the g++ command to your include directory is the same path that you have specified in your -I flag. If those are the same then please make sure there is a sdl2 folder inside your specified include folder, and and sdl.h within that folder. I am really bad at responding to youtube comments as youtube doesn't notify me of replies, if you would like quicker responses and are comfortable with joining a discord, please join my discord and hop into debugging discord.gg/eqz5jHSUy4. else, I can try to keep an eye out on youtube to help. though I am not super sure how frequent that will be.
@dazarak8112
@dazarak8112 2 жыл бұрын
got this : SDL2/SDL.h: No such file or directory
@alexro_off
@alexro_off Жыл бұрын
It says there's no make command: The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program.
@herbglitch
@herbglitch Жыл бұрын
can you please try running mingw32-make instead of make, and if that doesn't work you might need to install make. Make can be installed from chocolaty (if you have that). I think winget has it as well. or if you don't know either of those, gnuwin has it gnuwin32.sourceforge.net/install.html. I got this link from this stack overflow post stackoverflow.com/questions/32127524/how-to-install-and-use-make-in-windows so I think it is safe, though I would still scan with a virus checker just in case. I am not the best at answering youtube comments, I'll try keeping an eye out, but I am active on discord if you are comfortable with that (link is in the description of this video)
@sonorousgaming7202
@sonorousgaming7202 Жыл бұрын
THANK YOU 😭
@herbglitch
@herbglitch Жыл бұрын
no problem :)
@prachipatil9726
@prachipatil9726 3 жыл бұрын
Can you help me please? 'make' is not recognized as an internal or external command, operable program or batch file
@herbglitch
@herbglitch 3 жыл бұрын
to use make, you first have to download, install, and add it to path in windows. I used gnuwin32.sourceforge.net/packages/make.htm to download the "Setup program", then made sure to add it to path. I scanned for viruses and don't think there are any viruses, however I suggest scanning and checking for your self if you download it. I hope this helps
@veterstift9411
@veterstift9411 8 ай бұрын
Thank you!!
@herbglitch
@herbglitch 8 ай бұрын
I'm glad it was helpful :)
@langibryant1223
@langibryant1223 2 жыл бұрын
Your C++ is making my C go ++ ;)
@herbglitch
@herbglitch 2 жыл бұрын
Sorry I can't hang out this week, I don't want to get you sick. also, I am confused with the comment, but aaight :)
@kameramanzaspal9821
@kameramanzaspal9821 2 жыл бұрын
Hey, loved your tutorial but i want to add sdl_image and i don't know how to implement it to vs code
@herbglitch
@herbglitch 2 жыл бұрын
You can place the SDL_Image files with the src file you have. here is an example of what I am talking about: github.com/herbglitchYT/SDL2_Img_Base.git
@nikeedev
@nikeedev 3 жыл бұрын
This doesnt work! Visual studio says that it cant find . Also how im supposed to use Makefile, is that a Windows function?
@herbglitch
@herbglitch 3 жыл бұрын
if you are going to use make, you will want to install make for windows and add it to the path. I used this link gnuwin32.sourceforge.net/packages/make.htm (the setup program) for that. and intelisense isn't recognising where your files are, so you will want to update your settings for intelisense to search your workspace folder as well for the headers
@mohamedabdelazizsaadali771
@mohamedabdelazizsaadali771 2 жыл бұрын
Make dont work ??
@youdi615
@youdi615 6 ай бұрын
i tried using the 64bit sdl but i keep getting errors. I have a 64 bit os and the 64bit version of mingw. i saw that in other tutorials people also used the 32bit version, is there a reason for that?
@herbglitch
@herbglitch 6 ай бұрын
I'm not sure as I haven't looked into it. I'm sure there is a way to compile for 64 bits, but 32 bit should work on a 64 bit machine. If you want to use the 64 bit version, I would recommend using msys2 as they have some 64 bit versions of mingw and you can pull down the sdl2 package with their pacman. If you would like help with any of this programming stuff, I'm much more active on discord, my channel is discord.gg/eqz5jHSUy4 or my username is herbglitch. I hope this helps
@twondai2642
@twondai2642 2 жыл бұрын
not sure how, but this doesn't open up an SDL window, it opens up my windows mouse and pointer settings when I run the code. Very strange
@herbglitch
@herbglitch Жыл бұрын
sorry for a late response, that tends to happen when running in powershell (I am not sure why), so to run in powershell I think you type ./main.exe
@Wafflebro
@Wafflebro 2 жыл бұрын
Awesome tutorial thank you. I just want to know why we need 32 bit and not 64. I tried to be a free thinking fella and do 64 bit equivalent stuff but it didnt work, and as soon as i switched the 64 to a 32 on the makefile it worked.
@nickgennady
@nickgennady Жыл бұрын
Yha I am trying to figure out 64 bit way. Its needed for other platforms like MacOS
@mikael808
@mikael808 2 жыл бұрын
Do you know how I can include sdl ttf and sdl mixer? They were recently moved to github :) Could you for ex. create an example project, like you did for sdl image?
@mikael808
@mikael808 2 жыл бұрын
never mind i got it working, thanks for the setup tutorial! :)
@herbglitch
@herbglitch 2 жыл бұрын
Awesome sauce :). I am glad you figured it out!
@ahmeddib9515
@ahmeddib9515 3 жыл бұрын
I downloaded the file you provided on github and opened it in vs code but I can't make the .exe. Shows a bunch of undefined reference errors and then this error "make: *** [Makefile:2: all] Error 1" Any suggestions?
@herbglitch
@herbglitch 3 жыл бұрын
Could you please send the errors, I am not super positive what is going on, but have a few ideas. The errors should hopefully help me narrow down what could be happening
@ahmeddib9515
@ahmeddib9515 3 жыл бұрын
I'm posting it on your discord in a .txt file because the message is too large to be posted :p
@julianhemmer1003
@julianhemmer1003 2 жыл бұрын
@@ahmeddib9515 did you have any respond to this error i got it too
@ahmeddib9515
@ahmeddib9515 2 жыл бұрын
@@julianhemmer1003 i think i was using a different version of mingw to his. He provides it in another video.
@matthewdempsey7455
@matthewdempsey7455 18 сағат бұрын
goat
@1..1..1..1H
@1..1..1..1H 7 ай бұрын
Can you help me with make, I does not recognize it, error make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + make + ~~~~ + CategoryInfo : ObjectNotFound: (make:String) [] , CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException Help please
@herbglitch
@herbglitch 7 ай бұрын
sorry for the late reply, can you please try running "mingw32-make", if that doesn't work, I'm happy to walk you through fixing this issue on discord (youtube comments are a nightmare for me to deal with). here is my discord server: discord.gg/eqz5jHSUy4 if you would rather you can dm me on discord, my username is herbglitch
@1..1..1..1H
@1..1..1..1H 7 ай бұрын
@@herbglitch It worked thank you! I subbed. and your reply was not late at all, I never had a reply on a 2 years old video lmao
@mavi3348
@mavi3348 9 ай бұрын
I don't know what to do. I watched this video many times over but I still get a problem where it keeps telling me fatal error: SDL2/SDL.h: 'No such file or directory'.
@herbglitch
@herbglitch 9 ай бұрын
Would you mind hopping in discord to try to debug. The main guess I have is that your `-Isrc/include` might not match with the folders you have. please make sure include uses a lowercase i. if that doesn't work I have a few other ways to setup SDL2 that I am more than happy walking through on discord
@F4biano
@F4biano 9 ай бұрын
@@herbglitch hi I'm having the same issue, was a solution found?
@herbglitch
@herbglitch 8 ай бұрын
@@F4biano sorry for a late response. There are a few ways to go about solving this issue. usually it has to do with the -I flag and the path you are giving the compiler to find SDL.h, it might be as simple as changing the include from #include to #include . KZfaq comments are a nightmare for me to navigate, so if you would like help, I am on discord and matrix (though I am still trying to figure out matrix). The discord server is in the description (I think), or my username is herbglitch. And on matrix my username is @herbglitch:matrix.org
@samuraipesho5242
@samuraipesho5242 Жыл бұрын
Hi I'm getting this error that I haven't found a fix to in the comments can you please help me? process_begin: CreateProcess(NULL, g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2, ...) failed. make (e=2): The system cannot find the file specified. make: *** [Makefile:2: all] Error 2
@herbglitch
@herbglitch Жыл бұрын
sorry for the late response, I am not super sure what is going on, but I can try to help debug on discord if you would be comfortable with that. A couple things to test would be if running "g++ -v" gives anything or if you are in the same directory as your Makefile (running "dir")
@huyo2141
@huyo2141 3 жыл бұрын
nice!
@herbglitch
@herbglitch 3 жыл бұрын
Thank you
@KookoCraft
@KookoCraft 3 жыл бұрын
lol jesus christ i wish i had this like four days before the upload date
@moisesdominguez3495
@moisesdominguez3495 Жыл бұрын
it give me this error when I try to compile -lmingw32: No such file or directory
@herbglitch
@herbglitch Жыл бұрын
can you please give the full error message. I am a lot more active on discord if you would be chill with debugging there, otherwise I'll keep an eye out here
@gudfishpoop3188
@gudfishpoop3188 6 ай бұрын
what happened if instead of a window, Mouses Properties opens up
@herbglitch
@herbglitch 6 ай бұрын
you are probably running with powershell. I think to run the exe in powershell you need to do .\main.exe
@Emanuel-oz1kw
@Emanuel-oz1kw Жыл бұрын
thanj you, thanks
@herbglitch
@herbglitch Жыл бұрын
np, I am glad you liked it :)
@RandomGuyOnDaFreakingNet
@RandomGuyOnDaFreakingNet 7 ай бұрын
this is the true definition of old is gold. 2 years old, but 200 kilograms worth of help
@herbglitch
@herbglitch 7 ай бұрын
Thank you :)
@astrah982
@astrah982 Жыл бұрын
On Windows, add: #define SDL_MAIN_HANDLED Above your #include sdl2 sdl.h line.
@herbglitch
@herbglitch Жыл бұрын
this is a good fix for undefined reference to WinMain. For personal projects, I have used int arc and char **argv in mains parameters and it works for my friend on windows. Thank you for this comment :)
@astrah982
@astrah982 Жыл бұрын
@@herbglitch Oh gotcha! I'm just a beginner so I didn't understand, that would work way better probably.
@herbglitch
@herbglitch Жыл бұрын
I am not confident the way I do it would work better than how you suggest tbh. I use linux, so I don't know too much about how windows handles program entry. I found this stack overflow a bit ago that talks more about why WinMain error is thrown stackoverflow.com/questions/32342285/undefined-reference-to-winmain16-c-sdl-2. The reason my videos are in windows is it is much harder to set things up there, and I have to figure out how to set stuff up for a friend who works in windows. And for being a beginner, you did really well finding that solution. The first time I tried fixing WinMain (back when I was using windows), it took me days to find a solution.
@FPChris
@FPChris 2 жыл бұрын
Why 32 bit?
@pardhivkondreddy6848
@pardhivkondreddy6848 2 жыл бұрын
Hey i downloaded the file you told me to still make command doesnt work i am not sure what i am supposed to do
@herbglitch
@herbglitch 2 жыл бұрын
sorry for the really late response, I have been on a kind of hiatus from youtube. Do you have make for windows installed and added to your path?
@mobileLZ
@mobileLZ 2 жыл бұрын
Thank you I just couldn't figure out what was wrong with this code // #include #include int main(int argc, char const *argv[]) { std::cout
@herbglitch
@herbglitch 2 жыл бұрын
I am glad this video helped out :)
@wuidemiyalouis6468
@wuidemiyalouis6468 2 жыл бұрын
Do I have to go through the same sepsif I am using codeblocks
@herbglitch
@herbglitch 2 жыл бұрын
I think code blocks has its own way to link libraries, so I am not too sure. However, if you compile via the terminal, it should work if you set it up this way. It just may not work if you try to compile in code blocks. Also, ULTRA in the discord server has used codeblocks, so he may be of more help than I am, if you want to join the server. He also has his own youtube channel I can link if you would like to contact him in his yt comments
@CarlAngeloAntenor
@CarlAngeloAntenor 3 жыл бұрын
Hi i tried this tutorial! but when i do the "Main" thing on the VSCode console it opens my mouse properties? Pls help
@herbglitch
@herbglitch 3 жыл бұрын
If you are using powershell can you try typing ./main.exe
@CarlAngeloAntenor
@CarlAngeloAntenor 2 жыл бұрын
@HerbGlitch I get an error ./main.exe : The term './main.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + ./main.exe + ~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (./main.exe:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
@CarlAngeloAntenor
@CarlAngeloAntenor 2 жыл бұрын
I also get this when make make: *** No targets specified and no makefile found. Stop.
@herbglitch
@herbglitch 2 жыл бұрын
@@CarlAngeloAntenor sorry for getting back to you so late. KZfaq didn't notify me of your messages. To run make you need to be in the folder that holds your Makefile. Pls run "dir" to see if your makefile is in that directory. can you pls try .\main.exe to try to run it. Also, if you want to debug, please hit me up on discord. I am much faster at responding there.
@EmmanuelMayor
@EmmanuelMayor 2 жыл бұрын
Is there a way to make this setup work but for compiling to 64-bit?
@nishi5708
@nishi5708 2 жыл бұрын
+1
@herbglitch
@herbglitch 2 жыл бұрын
I believe that is with the -m64 flag. I would have to do some more research into that, but currently am pretty time deprived as I started a pretty demanding job
@EmmanuelMayor
@EmmanuelMayor 2 жыл бұрын
@@herbglitch will try with that, thank you! Keep it up :D
@kenn1ld676
@kenn1ld676 Жыл бұрын
Nope, doesn't work for me. Says "no such file or directory" when having #include
@herbglitch
@herbglitch Жыл бұрын
can you please clarify on what is giving the "no such file or directory" error. If this error is being thrown when you run the Makefile, it is likely that your -I flag isn't pointing to the right location for your include folder. If you are comfortable using discord, I respond a lot faster there and can help. Here is my discord channel discord.gg/eqz5jHSUy4 . Else I can try to keep an eye out here to help debug
@user-yx1ry9zu1u
@user-yx1ry9zu1u 8 ай бұрын
all what i have to do is to use the wayback machine so I can download it instead of going to github.
@herbglitch
@herbglitch 7 ай бұрын
sdl2 has a releases page on their github, though I would recommend using msys2 for mingw and package managing (you can install libraries like sdl2 with packages on msys2 and it makes handling libraries on windows much easier). If you have any questions, please hit me up on discord. my discord server is discord.gg/eqz5jHSUy4 or if you would rather dm my username on discord is herbglitch
@dhananjaygola4786
@dhananjaygola4786 Жыл бұрын
'make' is not recognized as an internal or external command, operable program or batch file. There you go, the first error 🙃
@dhananjaygola4786
@dhananjaygola4786 Жыл бұрын
Just figured, in windows it is mingw32-make.exe
@whatisuser
@whatisuser 7 ай бұрын
@@dhananjaygola4786 you can also rename the file to "make.exe" and everything will kind of be fixed haha.
@MikaKC
@MikaKC 2 жыл бұрын
Hey, I'm getting an error saying collect2.exe: error: ld returned 1 exit status Makefile:2: recipe for target 'all' failed mingw32-make: *** [all] Error 1 and I do not know how to fix it. I have tried to do the command mingw32-make and make and it always gave me the same error. I'm lost and I don't know how to fix it. Help would be appreciated :) My version of mingw is MinGW-w64, I don't know if the error is related with my mingw version.
@herbglitch
@herbglitch 2 жыл бұрын
Does it output any more errors? Also, would you be chill with debugging over discord some time. (KZfaq kinda sucks at notifying me about messages). If so my discord is herbglitch#0024, else I can try to remember to check here often to help debug
@MikaKC
@MikaKC 2 жыл бұрын
@@herbglitch Sorry, I forgot to paste this part of the error g++ -Isource/Include -Lsrc/lib -o bin/main scripts/main.cpp -lmingw32 -lSDL2main -lSDL2 c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lSDL2main c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lSDL2. Seems like it can't find SDL2 and SDL2main. I don't know why it does that error though. I do not have discord though...
@MikaKC
@MikaKC 2 жыл бұрын
Ahh I found the issue, I made a typo in the -Lwhateverpath/lib part. Thanks again for responding mate :)
@nein9420
@nein9420 2 ай бұрын
And if setting the include path DOESNT remove the error?
@herbglitch
@herbglitch 2 ай бұрын
well, this video was made in 2021, so I'm not sure everything will work the same as it did back when I made the video. I haven't used windows in a couple years so I don't know how they changed that extension. Does your project compile? Do you have another extension handling intellisense (like cmake)? does the path you passed have correct capitalization? If you respond in these comments I'm not sure I'll be notified, and I'm pretty bad at using youtube comments. If you would like help here is my discord server: discord.gg/eqz5jHSUy4 or you can direct message me, my username is herbglitch
@nein9420
@nein9420 2 ай бұрын
@@herbglitch Turns out that I am really stupid and have fixed my problem now. Sorry for bothering you but thank you for offering help nonetheless.
@herbglitch
@herbglitch 2 ай бұрын
@@nein9420 You aren't stupid, and I'm glad to hear you figured out the fix :). I hope you enjoy programming
@whosnooby
@whosnooby 3 жыл бұрын
tysm!
@herbglitch
@herbglitch 3 жыл бұрын
np :)
@akshatbisht2760
@akshatbisht2760 3 жыл бұрын
Will this work in case of mac os as well? Sorry I am a newbie , I couldn't find any video on how to use opengl and SDL through vscode on Mac os.
@herbglitch
@herbglitch 3 жыл бұрын
I am not positive about how mac's compile. Are you using mingw on your Mac (g++)? If so, I believe it should work.
@yeppiidev
@yeppiidev 3 жыл бұрын
@@herbglitch i think mingw is a gcc port for windows so may not work on mac.
@herbglitch
@herbglitch 3 жыл бұрын
@@yeppiidev I think you are right. Though, if the ported version of g++ is the same that is used on mac, the binaries should still work (I would think)
@yeppiidev
@yeppiidev 3 жыл бұрын
@@herbglitch I guess xcode provides gcc and other tools and it's pretty similar to that which comes with linux. I mean I could be wrong but who knows
@herbglitch
@herbglitch 3 жыл бұрын
@@yeppiidev I had no idea xcode used gcc. I hope it works. I guess someone with a mac would have to let us know if it works
@gabriel_wingard
@gabriel_wingard 2 жыл бұрын
I get an error when doing the make command: make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + make + ~~~~ + CategoryInfo : ObjectNotFound: (make:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException I downloaded the gnuwin32, but i didn't get it to work more than that. I tried to set it to path but i did not succed. Do you know what I should do here? Edit: I got it kind of working. When i type main in vscode terminal after make it does not open the program. But if I type .\\main, it opens. Something I can mention is that the exe file from the file explorer has always been working. Edit2: I somehow worked it out, changed terminal
@herbglitch
@herbglitch 2 жыл бұрын
you may need to get make for windows. I believe that winget and chocolaty have it, and it is downloadable from www.gnu.org/software/make/ though you will most likely have to add it to path if downloaded
@HaiNguyen-fx2tx
@HaiNguyen-fx2tx 2 жыл бұрын
Same problem here :( dont know what to do When i type 'main' in the terminal, it opens my mouse properties =.= wth
@gabriel_wingard
@gabriel_wingard 2 жыл бұрын
Change terminal from poweshell to cmd
@HaiNguyen-fx2tx
@HaiNguyen-fx2tx 2 жыл бұрын
@@gabriel_wingard Thank u so much! I am really grateful :"> Spent the whole day searching for the problem that can be solved with 3 clicks
@Cookie-mv2hg
@Cookie-mv2hg 2 жыл бұрын
Please share your vs code theme !! It's awesome
@herbglitch
@herbglitch 2 жыл бұрын
I used the extension rainglow, and chose the theme absent. I hope this helps :)
@user-vu5ro1rp7y
@user-vu5ro1rp7y 2 жыл бұрын
When I run the program it opens the mouse properties lmao. Is that supposed to be that way?
@herbglitch
@herbglitch 2 жыл бұрын
I am pretty sure this has to do with powershell. I think the way to fix it is to use .\main.exe
@Momo0030
@Momo0030 2 жыл бұрын
@@herbglitch It’s working yes 👏
@phonglai86
@phonglai86 8 ай бұрын
sir, can you pls help me how to write cmakelists.txt with sdl2
@herbglitch
@herbglitch 8 ай бұрын
sorry for responding super late response, If you still need help setting up sdl2 with cmake, I can help on discord. I also have a template on github github.com/herbglitchYT/SDL2_CMake_Base though if you use that you will probably want to use msys2 to handle the cmake package. my discord server is discord.gg/eqz5jHSUy4 or if you would rather dm, my username is herbglitch
@phonglai86
@phonglai86 8 ай бұрын
@@herbglitch thank you so much
@maxa.9135
@maxa.9135 2 жыл бұрын
it tells me it can't find the -lmingw32 ?????????
@herbglitch
@herbglitch 2 жыл бұрын
which compiler are you using? and does it work if you don't use that flag?
@chickmagnet2067
@chickmagnet2067 3 жыл бұрын
What to write in Makefile if I downloaded as VC zip ? Thanks in Advance !!
@herbglitch
@herbglitch 3 жыл бұрын
what do you mean by a VC zip? the compiling arguments should stay the same if you are on windows and have put the lib and include files in src.
@chickmagnet2067
@chickmagnet2067 3 жыл бұрын
@@herbglitch What I meant was when you go on sdl2's website to download it, you get 2 options:- one is SDL2-devel-2.0.16-VC.zip (Visual C++ 32/64-bit) and other is SDL2-devel-2.0.16-mingw.tar.gz (MinGW 32/64-bit). So I guess you mean your sol'n would work in Vc zip also?
@herbglitch
@herbglitch 2 жыл бұрын
Sorry for responding so late. If you are trying to compile with mingw, I don't thin the VC zip will work because it was compiled for visual studio and that uses clang as its compiler (I think)
@chickmagnet2067
@chickmagnet2067 2 жыл бұрын
@@herbglitch right. Thanks👍
@xrobin7205
@xrobin7205 Жыл бұрын
i dont get an error but my main.exe doesnt do anything lol.
@herbglitch
@herbglitch Жыл бұрын
Please make sure you have to sdl dll in the same folder as your exe. also, you may be able to get an error message (to see what is going on) by opening the file explorer, going to where your exe is, and double clicking it
@shikhindahikar8488
@shikhindahikar8488 3 жыл бұрын
why do we use 32 bit one and not 64 bit?
@herbglitch
@herbglitch 3 жыл бұрын
The main reason is that I believe mingw by default compiled for 32, so if you want to do 64 you need to add a flag
@yamm_gx
@yamm_gx 8 ай бұрын
What flag should be added? I’m currently doing it for the 64 bit but can’t figure it out 😢
@Flamenc0
@Flamenc0 2 жыл бұрын
Are you really using cmd to unpack archives xD Omg
@worm_dxd3930
@worm_dxd3930 3 жыл бұрын
when i do make it dont work
@herbglitch
@herbglitch 3 жыл бұрын
sorry for responding super late, I assumed I helped you fix this on discord. Do you still want help?
@akshayshetty2484
@akshayshetty2484 6 ай бұрын
Cd programs is not working
@herbglitch
@herbglitch 6 ай бұрын
sorry for responding so late, programs in this case is a folder I have created. you could cd Desktop which would be your desktop, or cd Documents which would be your documents. I like having my programs in their own folder within my home directory, so I ran mkdir programs to make a programs folder in the home directory. You can use file explorer to do most of this
@sharkPause1
@sharkPause1 2 жыл бұрын
help the compiler won't recognize SDL_Init even though I did everything in the video
@herbglitch
@herbglitch 2 жыл бұрын
can you please send the error message
@sharkPause1
@sharkPause1 2 жыл бұрын
@@herbglitch undefined reference to 'SDL_Init'
@herbglitch
@herbglitch 2 жыл бұрын
@@sharkPause1 do you have (int argc, char *argv[]) as your main functions parameters?
@sharkPause1
@sharkPause1 2 жыл бұрын
@@herbglitch I don't think so, I'll try it
@sharkPause1
@sharkPause1 2 жыл бұрын
@@herbglitch Still getting the same error
@sovietxcp4288
@sovietxcp4288 3 жыл бұрын
hey mate i have tried everything to remove this error but still it doesn't work(#include errors detected. Please update your includepath. Squiggles are disabled for this translation unit) with (#include )
@herbglitch
@herbglitch 3 жыл бұрын
can you try "#include " and tell me if it works or not?
@sovietxcp4288
@sovietxcp4288 3 жыл бұрын
Still it has the red line under it
@herbglitch
@herbglitch 3 жыл бұрын
@@sovietxcp4288 ok, if you press [ctrl] + [shift] + [p] then go to "Open Settings (UI)" then search for "cpp default include path", click on "Edit in settings.json", then make sure that it looks like this: "C_Cpp.default.includePath": [ "${workspaceFolder}/**" ], after that, does the errors go away?
@sovietxcp4288
@sovietxcp4288 3 жыл бұрын
@@herbglitch Still it has the red line
@herbglitch
@herbglitch 3 жыл бұрын
@@sovietxcp4288 would you be chill with debugging over discord tomorrow? I am about to hit the sack rn. if so, my discord handle is herbglitch#0024, else, we can continue here. Pls let me know
@vovav.1375
@vovav.1375 3 жыл бұрын
Hi guys, can you help me? I build the file but instead of the form i get my mouse properties...
@herbglitch
@herbglitch 3 жыл бұрын
would you be chill with jumping on discord to debug? I am not quite sure what your problem is.
@vovav.1375
@vovav.1375 3 жыл бұрын
@@herbglitch Yep, I would be so grateful if you gonna help me with this "strange" situation)
@herbglitch
@herbglitch 3 жыл бұрын
@@vovav.1375 would you be chill with discord? if not, what is your strange situation?
@vovav.1375
@vovav.1375 3 жыл бұрын
@@herbglitch DeadWatch#2649 my discord
@moomoocows5829
@moomoocows5829 3 жыл бұрын
What worked for me was to change my terminal in VSCode. Your terminal must be using powershell and when you type main in powershell it will open mouse properties, so make your terminal use cmd instead.
@dacchanneldac8742
@dacchanneldac8742 3 жыл бұрын
Do you can help me?, my vscode displays this error "fatal error: SDL2/SDL.h: No such file or directory 1 | #include ", I searched but I didn't find anything to help me with it.
@herbglitch
@herbglitch 3 жыл бұрын
Is this when compiling or in the editor?
@dacchanneldac8742
@dacchanneldac8742 3 жыл бұрын
When i compile :(
@herbglitch
@herbglitch 3 жыл бұрын
@@dacchanneldac8742 ok, it probs has to do with pathing when linking, what does your file tree look like?
@dacchanneldac8742
@dacchanneldac8742 3 жыл бұрын
@@herbglitch C:\Users ame\Desktop\project this last folder is the same as the video
@herbglitch
@herbglitch 3 жыл бұрын
@@dacchanneldac8742 I mean like how does your folder setup look? exampe: project |-src | |-include | |-lib | |-Makefile
@lorenzomedici8675
@lorenzomedici8675 2 жыл бұрын
makefile:2: *** missing separator. Stop. that's what's happend when i inpute make
@herbglitch
@herbglitch 2 жыл бұрын
I think that the indentation in make is with four spaces instead of a tab (it is really frustrating that that is a thing), can you pls try replacing that indentation with a tab?
@hamzaker829
@hamzaker829 Жыл бұрын
Where are you man, we miss you
@herbglitch
@herbglitch Жыл бұрын
I am sorry for being away so long. I decided that it would be smart to build out a decent sized project in a game engine I am making before making more videos (the game series videos were was riddled with bugs, and I want to make quality videos). I also got a job in embedded systems that has taken up most of my life. This channel hasn't been abandoned, it might be a few months till I get another video put together though
@hamzaker829
@hamzaker829 Жыл бұрын
@@herbglitch Wish you all the best buddy, I'll be here waiting for another vid :D
@herbglitch
@herbglitch Жыл бұрын
@@hamzaker829 Thank you, I appreciate it. I wish the best as well :)
@Veloscocity
@Veloscocity 9 ай бұрын
Why couldn't the actual SDL devs make a tutorial this straightforward? instead they gave us an ungodly amount of unhelpful READMEs
@Aa-jq3yu
@Aa-jq3yu 3 жыл бұрын
in 3:04 when you type "main", it works for you but i get error "The term 'main' is not recognized as the name of a cmdlet, function, script file, or operable program." Do you know whats the problem?
@herbglitch
@herbglitch 3 жыл бұрын
Are you in the directory that contains your main.exe?
@Aa-jq3yu
@Aa-jq3yu 3 жыл бұрын
@@herbglitch Yes, only when i type ".\main.exe" it runs. "main" nor "main.exe" doesnt work
@herbglitch
@herbglitch 3 жыл бұрын
I will Google this really quickly, I am not sure what is happening
@herbglitch
@herbglitch 3 жыл бұрын
Oh, one more question, are you in cmd or powershell?
@Aa-jq3yu
@Aa-jq3yu 3 жыл бұрын
@@herbglitch looks like I was using powershell, changing it to cmd fixed the problem. Thanks for help and great tutorial!
Why do we use SDL with C & C++?
16:26
pikuma
Рет қаралды 42 М.
Fast and Furious: New Zealand 🚗
00:29
How Ridiculous
Рет қаралды 45 МЛН
小蚂蚁被感动了!火影忍者 #佐助 #家庭
00:54
火影忍者一家
Рет қаралды 36 МЛН
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 29 МЛН
IQ Level: 10000
00:10
Younes Zarou
Рет қаралды 11 МЛН
I'm Gonna Try Zed Now (RIP VSCode)
13:37
Theo - t3․gg
Рет қаралды 173 М.
Making a Game With C++ and SDL2
5:34
Goodgis
Рет қаралды 602 М.
Why The Windows Phone Failed
24:08
Apple Explained
Рет қаралды 249 М.
CMD PRANKS! (Educational Purposes ONLY!)
9:17
Veraxity
Рет қаралды 1,4 МЛН
Why You NEED a DRIVER (for hacking games)
8:03
cazz
Рет қаралды 447 М.
SDL2 and SDL_image CMake Package Setup (MinGW, VScode, Windows)
23:10
Can I Run Youtube Entirely From My Terminal? (No Browser)
15:31
How to add SDL2 in Visual studio code!! Fix all errors!!
7:11
Afisn Drivs
Рет қаралды 11 М.
Making Minecraft from scratch in 48 hours (NO GAME ENGINE)
16:38
Fast and Furious: New Zealand 🚗
00:29
How Ridiculous
Рет қаралды 45 МЛН