SDL 2 Tutorial Windows and Visual Studio Code Setup | Visual Studio Code, Game Dev

Поділитися
Вставка
  • Опубліковано 19 січ 2025

КОМЕНТАРІ • 339

  • @zijielin2086
    @zijielin2086 Рік тому +84

    for everyone who got errors after makefile, you could: (1) use include, bin folders from folder x86_64-w64-mingw32 instead of the one selected in the video, because your computer identifies 64 bits version, not 32 bit version. (2) type comment "g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2" directly into terminal instead of using makefile. (3) type comment "./main" in the terminal.

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому +9

      Thank you for sharing

    • @DJCreepero
      @DJCreepero Рік тому +3

      That was very helpful but do you have any tips with how to turn on the main.exe but it keeps getting "This application couldn't start properly"

    • @siqretreves
      @siqretreves Рік тому +1

      Thank you!! you just saved my day!

    • @vovchdersacapat1264
      @vovchdersacapat1264 Рік тому

    • @ahmedmuthanna1524
      @ahmedmuthanna1524 Рік тому +3

      Sir, you are literally a blessing to humanity. You are like my guiding star, illuminating my path and filling my world with joy. Your presence brings a warmth that melts my heart and a smile that brightens my day. I'm grateful to have crossed paths with someone as captivating as you.

  • @tomasvallejos1609
    @tomasvallejos1609 2 роки тому +88

    if the command "make" doesn't work for you, try typing "mingw32-make" instead.
    if you want to use it by typing "make", what I did was to duplicate the file "mingw32-make.exe" located in "C:\MinGW\bin" and rename it to "make.exe".
    it's probably not the cleanest but it is simple and it worked for me.

    • @6H075T2
      @6H075T2 2 роки тому +1

      i installed my mingw compiler from sourceforge it doesnt have mingw32-make

    • @DeltaEchoVictor
      @DeltaEchoVictor 2 роки тому

      @@6H075T2 run mingw32-get install maingw32-make

    • @yikiangaming3981
      @yikiangaming3981 2 роки тому +1

      OMMMMMMMMMMMMMMMMMGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG THANK YOU SO MUCH I WAS TRYING TO FIGURE OUT WHY IT WASN'T WORKING FOR DAYS AND YOU JUST HELP SAVE MY LIFEEEEEEEEE THANK YOUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU :)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

    • @tomasvallejos1609
      @tomasvallejos1609 2 роки тому

      @@yikiangaming3981 I'm glad it helped you :)

    • @daved1113
      @daved1113 Рік тому +2

      You can change the name of that "mingw32-make.exe" file to "make.exe" and then you can just run the command "make" from the command line as long as you add it to the path correctly.

  • @MrDrNarwhal
    @MrDrNarwhal Рік тому +19

    I had been struggling to get SDL2 to work in Eclipse for days, before I finally broke down and transitioned to Visual Studio Code. Your video was quick, clear, and informative; thank you!

    • @d7584
      @d7584 Рік тому +1

      broke down with geany here

    • @tntdoboom
      @tntdoboom 10 місяців тому

      for me it been years

  • @monke3397
    @monke3397 Рік тому +3

    Bro, I was waiting for you, Godsend man. There were always tutorials for Visual studio, or VSC that weren't that good. This one slaps, like the details, testing if it works and explaining along the way. Giving it a thumbs up!

  • @siiiiiiiiiiiiiiiiiiiiiiiiiiiis
    @siiiiiiiiiiiiiiiiiiiiiiiiiiiis 2 роки тому +3

    Thank you very much from japan.
    I had difficulty in using SDL2 and searched for how to use it. Then, I found this video and I can solved this problem. I really appreeciate it.

  • @MrNeozerahan
    @MrNeozerahan 11 місяців тому +5

    If you are facing issues running building the Makefile then try the below steps:
    1. Copy the i686-w64-mingw32/lib and /include folder into the src folder of your VSCODE project. Make sure you copy the lib and include folders manually instead of dragging and dropping it in VSCode. The folder structure is important i.e src/include and src/lib
    2. Copy the i686-w64-mingw32/bin/SDL2.dll from the bin folder to your project folder.
    3. For me, g++ was not working so I used gcc in the Makefile and finally got to work.
    Happy game development!

  • @tuanhungnguyen7924
    @tuanhungnguyen7924 Рік тому +6

    I get the error "No such file or directory #include ", how to fix this error?

    • @Tarkonian
      @Tarkonian 11 місяців тому +1

      I've got an error just like this and can't find anything on stack overflow on how to address this. Is this tutorial out of date? Error: "SDL2/SDL.h: No such file or directory' @SonarSystemsCoUk

    • @Jon205-g9r
      @Jon205-g9r 20 днів тому

      I had the same error. Worked out the solution was that I had made a couple of typos in the Makefile file. I had missed a '-' and also I had named my folder SRC not src, so needed to correct that.

  • @alomac8976
    @alomac8976 11 місяців тому +2

    If you're STILL getting errors even after using the 64 version of SDL2, then (1) replace your PATH variable for mingw/bin with the one for mingw64/bin. (2) Just add mingw64/bin to PATH variable without replacing the mingw/bin, and rename the g++ in mingw64/bin to something like g++64 and then change your command from (g++ main.cpp) to (g++64 main.cpp)
    This issue happened to me because I installed minGW first, then later installed minGW64

  • @em_raaa
    @em_raaa 2 роки тому +17

    TO EVERYONE WHO GOT THE ERROR AFTER THE MAKE FILE
    if you are on windows 11 make sure you are using the 64 bit version of SDL as the 32 is not supported.. 32 bit version is selected in this tutorial

    • @jozburn7503
      @jozburn7503 2 роки тому +2

      anything else that needs to be changed to make this work? I'm getting an error now when I try to use ./main, which when looked up everyone says its the wrong OS and that the json file needs to be edited. Any advice?

    • @em_raaa
      @em_raaa 2 роки тому +1

      @@jozburn7503 hmm make sure you put the SDL.dll from the 64 bit folder as well. this worked for me, also make sure you delete the broken exe if it made one

    • @jozburn7503
      @jozburn7503 2 роки тому

      @@em_raaa my compile line is "g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2", and I have the SDL2.dll in the project folder (but NOT the src folder, just in the same folder as main.cpp and main.exe) but it doesn't work

    • @abhinavdevarakonda7519
      @abhinavdevarakonda7519 2 роки тому +2

      i love you

    • @KneeCapThief
      @KneeCapThief 2 роки тому

      If you are having other makefile problems such as your system not finding the file, or the 'make' command not working. installing 'GNU make' and restarting worked for me.

  • @lanatrzczka
    @lanatrzczka Рік тому +20

    This is a VERY good tutorial. For Windows 11 users, as noted by @em_raaa below, be sure to use the include, lib, and SDL2.dll from the 64 bit folder. 32 bit won't compile. I would like to add that if you double-click the final exe from the GUI this SDL2 window will also open a console window. This can be resolved by adding the flag -mwindows to the Makefile. Maybe a lot of you already know that, but it was new to me. Cheers!

  • @draghicistefan1984
    @draghicistefan1984 Рік тому +7

    I tried this example, and I get this error when I run make: make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. What could be the problem?

    • @adamsalem-s
      @adamsalem-s Рік тому

      you dont have mingw or probably a compiler installed

    • @rishabgupta2733
      @rishabgupta2733 Рік тому +2

      @@adamsalem-s I have download both the vs code and mingw but still it is saying that sdl2 header file cannot be recognized
      can you help me out? please

  • @arizsheikh1889
    @arizsheikh1889 Рік тому +5

    when i type make in terminal i get 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."

  • @lenoel7666
    @lenoel7666 Місяць тому

    it finally worked, thanks for the tutorial!

  • @adra404
    @adra404 Рік тому +2

    it's so clear and full of useful explanations!! thank you, you're a lifesaver!!

  • @humbledcomposer
    @humbledcomposer Рік тому +7

    Thumbs up because you used a makefile and not a json. Thank you, for understanding why we use vscode! Now if only microsoft could figure it out and stop turning it into visual studio! Subscribed too.

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому +1

      Awesome to hear it helped

    • @Prof.RafaelJunqueira
      @Prof.RafaelJunqueira Місяць тому

      If you don't use json, you are not a programmer, is a final user. Json is used for all applications. Makerfile is use only on vscode.

    • @humbledcomposer
      @humbledcomposer 26 днів тому

      @@Prof.RafaelJunqueira First of all its makefile, not makerfile. And makefile is used across several ide's and is not only used to launch vscode. I stopped using makefile on windows in favor of the much simpler .bat files years ago.
      Secondly, json is a preference, not a requirement of programming. The more complex a piece of software becomes, the more a team is likely to depend on a custom data storage solution rather than the overly compatible but not optimized json. Not even xml is optimized. But you would know that, being an expert one what it takes to be a programmer, right?
      However, we use vscode to steer away from the cumbersome automation of Visual Studio and similar software like Rider, Mono and Eclipse. vscode implemented jsons are a step too close to such automation.
      I am not a fan of json in this sense. That is my preference, and I am thankful to work with a team who mostly shares that sentiment. I personally have two released games on steam, and have worked on more than 400 development projects in the last 7 years across 12 languages in 3 cities. So if I am not programmer, please, for the love of all that is good in the world, point me toward someone who is!

  • @FelixNielsen
    @FelixNielsen Рік тому

    Quite contrary to the norm, especially for older tutorials, this setup worked like a charm. Thanks.

  • @aleksandrnikolaev2914
    @aleksandrnikolaev2914 Рік тому +4

    Here, a person @Zijie Lin wrote a solution to problems that most likely will arise for many. who got errors after makefile, you could: (1) use include, bin folders from folder x86_64-w64-mingw32 instead of the one selected in the video, because your computer identifies 64 bits version, not 32 bit version. (2) type comment "g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2" directly into terminal instead of using makefile. (3) type comment "./main" in the terminal.
    But I would like to understand how to build and run all this as it should be and what is the problem of this error. For example, when I run the makefile that the author wrote, the system gives an error and the file main.cpp is deleted on its own.
    It is also very interesting how to install the same library in a C project.
    In addition, the author quietly runs the 'make' command, but I have to write 'mingw32-make' and no one says a word about it

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому +2

      What computer are you using?

    • @aleksandrnikolaev2914
      @aleksandrnikolaev2914 Рік тому +2

      @@SonarSystemsCoUk i'm using windows 11. This Makefile command all:
      g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2 worked for me finally. Thank you for the video. If it's not hard for you. I'm trying to do the same thing but in C language and also include the nuklear library for building graphic elements in a window program. Nowhere did I find a similar video for C :(

    • @sanchisingh481
      @sanchisingh481 Рік тому +1

      @@aleksandrnikolaev2914 thanks, this worked for me

    • @蔡銘哲-n5o
      @蔡銘哲-n5o Рік тому

      Thanks a lot!

  • @Faby__
    @Faby__ Рік тому +4

    great explaination! we need more people like you

  • @gammyhorse
    @gammyhorse 2 місяці тому +1

    Screw SDL, use Raylib. Piece of cake to set it up and way more fun to code with it.

  • @Hippo844
    @Hippo844 10 днів тому +1

    thank you very much you helped me alot man!

  • @steinberg3255
    @steinberg3255 Рік тому +4

    SDL.cpp:2:10: fatal error: SDL2/SDL.h: No such file or directory
    2 | #include

    • @banrtv
      @banrtv 8 місяців тому

      bro me too wtf

  • @BossStack
    @BossStack 11 місяців тому +1

    I saw that vimm's lair 👀good choice, good choice

  • @JackFire03
    @JackFire03 8 місяців тому +2

    fatal error: SDL2/SDL.h: No such file or directory

  • @eygon_amv
    @eygon_amv Рік тому +1

    OK so if you have an error like : undefined SDL_init and others like this, its because if you use SDL in 64 bits, you should download MinGW-64 bits version. In the video he uses a 32 bits version of SDL so if you have MinGW 32 bits there are no problems

    • @spacestrander
      @spacestrander 7 місяців тому

      thxxx

    • @alikhalid4677
      @alikhalid4677 3 місяці тому

      holy shit that did it. I tried this a year ago but stopped because of this error, I started this again with the same error and was about to pull my hair out. Thank you so much!!

  • @themagic8ball
    @themagic8ball 2 роки тому +5

    using 'make' just makes my main.cpp file to dissapear and shows error: undefined reference to `SDL_main' | collect2.exe: error: ld returned 1 exit status | make: *** [all] Blad 1

  • @sasikumar-rw5cb
    @sasikumar-rw5cb 11 місяців тому

    Thanks a lot dude. Went through many videos none of them seems to work. This one made my day. Great content keep it up.

  • @TheWSPepe
    @TheWSPepe Рік тому +1

    thanks a lot, this worked, the comment section also helped.

  • @jeanmakesgames
    @jeanmakesgames Рік тому +2

    doesnt work on my side, i cant create the main.exe although im clicking on the quick fix. I wonder what I'm doing wrong, i have SDL2 setup nicely on Visual Studio but on vscode 2022 it doesnt work

  • @YASH_BARNWAL
    @YASH_BARNWAL Рік тому +1

    My program says that no such file as SDL2/SDL.h and I have done everything shown in the video

  • @icehead192
    @icehead192 Рік тому +3

    I encountered this error:
    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.
    Makefile:2: recipe for target 'all' failed
    make: *** [all] Error 2
    I still can't find the solution for it, can you give me some advice?

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому +1

      When does this occur?

    • @icehead192
      @icehead192 Рік тому +2

      @@SonarSystemsCoUk It showed up when I entered the make command in terminal

  • @arnavkmr3895
    @arnavkmr3895 Рік тому

    You're a lifesaver, thank you so much dude! Have a nice day :)

  • @Phantom-ws2hj
    @Phantom-ws2hj 2 роки тому +5

    anyone know how to fix the issue "No such file or directory" for #include

    • @priyanshbhardwaj6313
      @priyanshbhardwaj6313 2 роки тому +1

      help me too if you fixed it

    • @botboarded
      @botboarded 2 роки тому +2

      Same here ✋

    • @Phantom-ws2hj
      @Phantom-ws2hj 2 роки тому +1

      @Melina ABC ive tried that and basically every other variation of it but nothing seems to work

    • @em_raaa
      @em_raaa 2 роки тому

      use 64 bit version of sdl if you are on windows 11

    • @duck6841
      @duck6841 2 роки тому

      @@em_raaa doesn't help

  • @lynnkuo2418
    @lynnkuo2418 2 роки тому +7

    This was a great tutorial but when i do it it just always says fatal error: : No such file or directory
    1 | #include
    it can't seem to find the #include, why??? please help me

    • @maximartinez5358
      @maximartinez5358 2 роки тому +1

      I have the same error.
      help !!!

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  2 роки тому +1

      stackoverflow.com/questions/10488775/sdl-h-no-such-file-or-directory-found-when-compiling

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  2 роки тому

      stackoverflow.com/questions/10488775/sdl-h-no-such-file-or-directory-found-when-compiling

    • @shadowslayer2248
      @shadowslayer2248 Рік тому

      Same error help someone

  • @ilanzup174
    @ilanzup174 2 роки тому +5

    Great video, more content about sdl2

  • @warioman91
    @warioman91 Рік тому +3

    I think for a lot of people getting compile issues(particularly the 'undefined reference to SDL_main') using the makefile----- just add the name of the file you are compiling (e.g. "g++ main.cpp ....")
    g++ main.cpp -I src\include -L src\lib -lmingw32 -lSDL2main -lSDL2 -o main

    • @MrThemercee
      @MrThemercee Рік тому +1

      I had this issue. The main.cpp was at the end, so moving it just after the g++ seems to have fix it. Thanks!

    • @rithu5285
      @rithu5285 Рік тому +4

      i'm still having the same compilation issues (undefined reference to `SDL_Init' ....) after doing what you've mentioned

    • @TheAlexthekido
      @TheAlexthekido Рік тому

      This solved my problem Thank you!

  • @bofoitakoyaki9859
    @bofoitakoyaki9859 Рік тому +2

    I have a strange problem, I did everything as said, but I get the error:
    main.cpp:2:22: fatal error: SDL2/SDL.h: No such file or directory
    #include
    ^

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому +1

      Did you follow all the steps?

    • @bofoitakoyaki9859
      @bofoitakoyaki9859 Рік тому

      @Hamza lol it was the letter L un-capitalized

    • @ijnokm7903
      @ijnokm7903 Рік тому

      ​@@bofoitakoyaki9859 where i shall put? L

    • @bofoitakoyaki9859
      @bofoitakoyaki9859 Рік тому

      @@ijnokm7903 watch carefully when he is creating the makefile. do it letter by letter

  • @prarabdhadighade
    @prarabdhadighade 2 роки тому

    Thank You very much, I struggled a lot to get sdl2.

  • @Qczerr
    @Qczerr 2 роки тому +3

    I have a problem in the line below it says:
    [{
    "resource": "/d:/Programowanie/C++/SDLTemplate/main.cpp",
    "owner": "C/C++",
    "code": "165",
    "severity": 8,
    "message": "too few arguments in the function call",
    "source": "C/C++",
    "startLineNumber": 10,
    "startColumn": 128,
    "endLineNumber": 10,
    "endColumn": 128
    }].
    Does anyone know what is wrong with it?
    SDL_Window *window = SDL_CreateWindow( "Hello SDL World", SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_ALLOW_HIGHDPI );

  • @JosephJosetar
    @JosephJosetar 2 роки тому +4

    This works, only if I run the command from the Makefile in the terminal. I don't know why the "make" command doesn't work, and I can't set up the build task either, it gives me an error that says it cant find main.cpp, even though it finds it when I manually write it in the terminal. Anyone got the build task working?

    • @DeltaEchoVictor
      @DeltaEchoVictor 2 роки тому

      to get make in windows
      run mingw32-get install mingw32-make
      go to C:\mingw\bin and replace wingw32-make with make

  • @PhoenixofFoce
    @PhoenixofFoce 2 роки тому +4

    VSCode couldnt find the libs. So i imported them from the x86_64 folder instead and then it worked

    • @crane550
      @crane550 2 роки тому

      Thanks for saying this. It saved me quite a bit of time flailing around. I coped over the other files and it worked instantly.

  • @shawaizhaider3978
    @shawaizhaider3978 Рік тому +1

    Thankyou so much man!!!

  • @FlareGunDebate
    @FlareGunDebate 2 роки тому +8

    This is the ONLY tutorial I've tried that has worked. Thank you!
    Only one question: when you write 'make' in the terminal are you calling CMake or are you using a VS Code extension?

    • @shreyashosahalli1222
      @shreyashosahalli1222 2 роки тому +4

      it is a g++ command for running makefiles

    • @FlareGunDebate
      @FlareGunDebate 2 роки тому +2

      @@shreyashosahalli1222 thanks for responding. Since I asked this question I fell down the whole mingw32-make, make, MakeFile, CMake rabbithole.

    • @homan-awa
      @homan-awa 2 роки тому

      which one exactly is it? I can't seem to get it to work either, if you solved it can you please reply? Thanks so much in advance!

  • @RayyanKhan-o8d
    @RayyanKhan-o8d 2 місяці тому

    I am working in C Language, and I want to use SDL for my semester project, I try to do all steps, but as I am writing the command make it is showing me error what should I do?

  • @SYDERXS
    @SYDERXS Рік тому +1

    Really helpful, thank you for the video !

  • @FellowInconsistent
    @FellowInconsistent Рік тому +6

    After running mingw32-make It said cannot find -lSDL2: No such file or directory

    • @shihyuehjan3835
      @shihyuehjan3835 7 місяців тому

      Make sure your file like this:
      your_project_directory/
      ├── main.c
      ├── src/
      ├── include/
      │ └── SDL2/
      │ └── SDL.h
      └── lib/
      └── libSDL2.a
      └── Makefile

  • @rainsidneyalberto7438
    @rainsidneyalberto7438 Місяць тому +1

    how to fix no such file or directory?

  • @TheBoxingBinge
    @TheBoxingBinge 2 роки тому +6

    I am getting an error when typing the "make" command. Then I downloaded minGW to try and solve it and it still didn't work? Could you help me?

    • @mudu3271
      @mudu3271 2 роки тому +2

      I had the same issue as you have. Try using "mingw32-make" instead of "make". I hope it works for you as it did for me

    • @TheBoxingBinge
      @TheBoxingBinge 2 роки тому

      @@mudu3271 Thanks I tried but now its saying g++: fatal error: no input files. But maybe I missed something

    • @joaobarreto3671
      @joaobarreto3671 2 роки тому

      @@mudu3271 I was getting the same problem Walter did, your tip solve my issue, thank you very much!

  • @thawzan7370
    @thawzan7370 2 роки тому +4

    Hi, when i key in "make" i get the following 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

    • @ZephyrCubic
      @ZephyrCubic Рік тому

      I have the same error, very confused

    • @ZephyrCubic
      @ZephyrCubic Рік тому

      I just used the same command ("make") in my cygwin terminal and it worked perfectly

    • @wakeelfurqanahmed2940
      @wakeelfurqanahmed2940 Рік тому

      maybe u have mingw32-make.exe, just rename it to make.exe
      or just do make --version (which is not working for u)
      then do mingw32-make --version (this should work, check if u have downloaded and it exists in bin folder)

  • @fincali197
    @fincali197 Рік тому +3

    Tysm! This was extremely helpful, setting up sdl2 on my own was pretty much impossible. I got some issues though, like I could not get vscode to run my makefile, although if I paste the code from there into the terminal, it still works(idk why but whtvr)

  • @abdulmoeez6546
    @abdulmoeez6546 2 роки тому +1

    I have a problem of "THIS APP CANT RUN ON YOUR PC" can anyone guide about this

  • @Cerus-YT
    @Cerus-YT Рік тому

    For include error click on edit "IncludePath" and under "${workspaceFolder}/**" add "src/include" or where ever your include file is, make sure to add a comma. it works for me and might work for you idk

    • @mouhanadatrash358
      @mouhanadatrash358 Рік тому

      BRO THANK YOU OH MY GOD YOU DONT UNDERSTAND HOW LONG IT TOOK FOR THIS TO WORK AND NO ONE MENTIONS IT ACTUAL LIFE SAVER

    • @Cerus-YT
      @Cerus-YT 11 місяців тому

      @@mouhanadatrash358thanks, Good luck on ur coding journey

  • @hrphyn
    @hrphyn 2 місяці тому

    I have a question, in the case of this line
    "all:
    g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2"
    Lets say If I wanted to change the main and main.cpp and alter it, for myself I put both files in a folder but since the path changed the file no longer run. How can I correctly alter and put the path into the makefile

  • @TenokiPoki
    @TenokiPoki Рік тому +1

    when i try to compile it just returns with not existing as a file or directory, also im using C so i have to make some adjustments i know

    • @ricardo1084
      @ricardo1084 11 місяців тому

      have you fixed this, i got the same error

    • @TenokiPoki
      @TenokiPoki 11 місяців тому

      @@ricardo1084honestly forgot how i fixed it, but if you come to the server, i can help

  • @yanhuaijin3244
    @yanhuaijin3244 2 роки тому +2

    The ONLY tutorial solved my problem in the past 2 weeks!
    However, I would like to know that how to solve the problem.
    When I run make, the cmd said command not found. How could I install it?

    • @magnuslaue3334
      @magnuslaue3334 2 роки тому

      Me too I have everything installed and i attempted to use the command and I got the same error

    • @yanhuaijin3244
      @yanhuaijin3244 2 роки тому

      @@magnuslaue3334 mingw32-make seems useful but its a bit too long
      I reinstalled my gcc and it ran properly at last

  • @diezohra
    @diezohra 11 місяців тому

    I had a lot of problems trying to get SDL2 running on my 64bit Windows 11 PC (with mingw64) using Visual Studio Code. I had a lot of problems(first with the make command, then main.exe error 0xc00007b), until I decided to install the 'SDL2-devel-2.30.0-VC.zip' (version for Visual Studio Code). Not sure if it was the include/lib folders or the 64-bit SDL2.dll file from that package, but it worked! Thought this might help some people.

    • @cmtdao442
      @cmtdao442 10 місяців тому

      I have to download that and then follow the video, right? Plz, respond

    • @diezohra
      @diezohra 10 місяців тому

      @@cmtdao442At least that's what I did. Just use the include and lib folders from the VSC version instead of the version mentioned in the video.

  • @_o_o_8472
    @_o_o_8472 2 місяці тому

    What if i want to compile a C file? Should i replace g++ with gcc and main.cpp with main.c? Or is it more complicated than that? And also, i keep getting this undefined reference error (.text+0xaa) thing, i don't know what to do, as you see, i'm quite new at this.

  • @issam76
    @issam76 Рік тому

    Program compiles correctly but cannot launch
    No string were prompted in the terminal.

  • @velsia1
    @velsia1 2 роки тому +2

    make doesn't work because you are not using the name of the file you want to run.
    This is the correct command:
    g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2
    This is the wrong command:
    g++ -I src/include -L src/lib -o main.cpp -lmingw32 -lSDL2main -lSDL2
    (this one misses the name of the file before main.cpp)
    if it still doesn't work the just open your folder and type ''cmd'' into the file directory and press enter then copy and paste the g++...... command on cmd, press enter then type the name of the file without the .cpp after and then press enter again, it will run your program and also create an .exe file.

  • @sunnanabdullah1413
    @sunnanabdullah1413 Рік тому +1

    i got this error "undefined reference to SDL_CreateWindow" someone know how to fix this.

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому +1

      The error message you mentioned typically occurs when the linker is unable to find a reference to the `SDL_CreateWindow` function. This error can be resolved by ensuring that you have properly set up the SDL library in your project.
      Here are some steps you can follow to fix this issue:
      1. Check SDL Installation: Verify that you have installed the SDL library correctly on your system. Make sure you have the necessary header files and libraries.
      2. Linker Configuration: Ensure that you have properly configured the linker settings in your project. You need to specify the correct library to link with your code. For SDL, you typically need to link with the SDL library and its related libraries.
      In CMake, you can add the following lines to your `CMakeLists.txt` file:
      ```cmake
      find_package(SDL2 REQUIRED)
      target_link_libraries(your_project_name SDL2)
      ```
      In GCC or G++, you can use the `-l` flag to specify the SDL library:
      ```
      gcc your_file.c -o your_executable -lSDL2
      ```
      Make sure you are linking against the correct version of SDL that you have installed.
      3. Include SDL Headers: Verify that you have included the correct SDL header file in your source code. You should have the following line at the top of your source file:
      ```c
      #include
      ```
      4. Check Build Process: Ensure that you are correctly compiling and linking your code. If you are using an IDE, make sure the necessary build steps are configured properly.
      By following these steps, you should be able to resolve the "undefined reference to SDL_CreateWindow" error. Remember to double-check your SDL installation and make sure you have the correct version of the library and headers.

  • @Lightminded-fj8kq
    @Lightminded-fj8kq 5 місяців тому

    It worked thanks

  • @phonglai86
    @phonglai86 Рік тому +1

    sir, how to do make ?

  • @leowolastname2250
    @leowolastname2250 Рік тому +2

    "No Targets specified and no makefile found, Stop." with make
    specifying the actual MakeFile gives me:
    "Nothing to be done for 'MakeFile'."

    • @BenBerke
      @BenBerke Рік тому

      did you solve it?

    • @leowolastname2250
      @leowolastname2250 Рік тому

      @@BenBerke no, lol, gave up 💀

    • @leowolastname2250
      @leowolastname2250 Рік тому

      (I programmed my silly little game idea in Godot instead)

    • @syrux2061
      @syrux2061 Рік тому

      ​@@BenBerke it's an easy fix! change the file directory in the terminal -->
      cd (location of your project)
      Hope this helps ;))

  • @KneeCapThief
    @KneeCapThief 2 роки тому +1

    my vsCode doesnt reconize any of the commands you can type in the terminal
    i have to manually copy paste the make file into the terminal for it to work. Is there something i need to install? Or have i installed something incorrectly?

    • @KneeCapThief
      @KneeCapThief 2 роки тому

      "make" and "./main" doesn't work. I have to copy paste it from the MakeFile into the terminal manually. Also, when I run the program a cmd opens up with it...

    • @KneeCapThief
      @KneeCapThief 2 роки тому

      I found a solution, I think. So yesterday I installed a program called "GNU make" via something called chocolaty. And after turning off my computer and starting it today the command works now. So does ./main. So, if you are having the same problems with make not working try installing 'GNU make' and restarting. And make sure your makefile is named "makefile" or has the file extension *.mk.

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  2 роки тому

      Thanks for sharing

  • @ahmetklnc7988
    @ahmetklnc7988 Рік тому

    when i typed make on the terminal it just gave an error saying"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 inclu
    ded, verify that the path is correct and try again." do you guys know the reason

    • @anon36939
      @anon36939 Рік тому

      Same issue, did you find a solution?

  • @t.studyyyy6972
    @t.studyyyy6972 Рік тому +1

    thanks but i have a question:
    I want to use the mingw-w64 instead of mingw-w32. How can i do that 😀😀

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому +1

      Either will work, same process.

    • @t.studyyyy6972
      @t.studyyyy6972 Рік тому

      @@SonarSystemsCoUk so i just need to replace mingw-w32 by mingw-w64?

  • @godswillchase1866
    @godswillchase1866 2 роки тому

    I get to error "Program 'main.exe' failed to run: the file or directory is corrupted and unreadable...
    pls how to I solve this?? 🤕

  • @mariof.1941
    @mariof.1941 Рік тому

    its now SDL3 its working only the SDL_Image wont work.... fatal error: SDL_image.h: No such file or directory

  • @kenetramirez6358
    @kenetramirez6358 2 роки тому

    Thanks it helped me a lot!!

  • @chasemontoure1462
    @chasemontoure1462 Рік тому

    Very good video but I'm still having trouble getting the make command to run. I tried running g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2 directly into the terminal but g++ was not recognized. Everything else is identical to what has been shown ({worspace}src/include in the header path and the SDL.dll in same location as main). I am not sure what else I am missing unless minGW needs to be installed into vsCode separately.

  • @Ikxi
    @Ikxi 11 місяців тому

    yea nope still not working for me
    why did we even copy the folder in the beginning and stuff
    the way you explain it feels somehow so confusing, I know less than before

  • @mouhanadatrash358
    @mouhanadatrash358 Рік тому

    I've been trying to add SDL_image on VS Code using this setup, but it hasn't been working. I installed SDL_image using MSYS2 as well as SDL and copy pasted the include and lib files to my src folder. Well everything works well I can even write commands from SDL_image such as IMG_LoadTexture, and it wont show me anything thats wrong. Its all fine and dandy until I run the code, I do ./main, and... nothing. I have put warning outputs if its null, but thats not it. It just, doesnt do anything. If I remove all functions from SDL_image, the code works fine. As long as we never mention anything from SDL_image, it works. Do you know how this can be fixed?

  • @leejuhsu
    @leejuhsu 8 місяців тому

    why is my launched window in black in instead of white like yours?

  • @scythaa3591
    @scythaa3591 2 роки тому

    help!!! when i run the exe file disappear and
    it says launch:program "exe file" does not exist

  • @boboricaalex9635
    @boboricaalex9635 Рік тому

    Thank you!One question , now if i make a c++ program using SDL library anywhere in my PC i just have to include the library,no?

  • @mandibchaulagain2
    @mandibchaulagain2 2 роки тому +2

    If like me, anyone else was greeted by this when we type make in the terminal,
    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
    _________________
    Then use MinGW32-make instead of make

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  2 роки тому

      Thanks for sharing

    • @nhuthaophan5077
      @nhuthaophan5077 Рік тому

      g++ -I src/include -L src/lib -o main main.cpp -lmingw32 -lSDL2main -lSDL2
      src/lib/libSDL2main.a(SDL_windows_main.o): In function `main_getcmdline':
      /Users/valve/release/SDL2/SDL2-2.26.3-source/foo-x64/../src/main/windows/SDL_windows_main.c:82: undefined reference to `SDL_main'
      collect2.exe: error: ld returned 1 exit status
      Makefile:2: recipe for target 'all' failed
      mingw32-make: *** [all] Error 1
      _____________________
      help me, please!

    • @arandomnamewithletters9903
      @arandomnamewithletters9903 Рік тому

      @@nhuthaophan5077 could you solve it?
      i have the same problem so i'd appreciate if you shared the solution

  • @anselmojimenez5723
    @anselmojimenez5723 2 роки тому

    I got the error:
    undefined reference to `WinMain@16'
    collect2.exe: error: ld returned 1 exit status
    make: *** [Makefile:2: all] Error 1
    I have saved my file, however the error persists.
    Any ideas?

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  2 роки тому

      Try using MinGW32-make instead of make

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  2 роки тому

      What's the exact error?

    • @evolve-yt
      @evolve-yt 2 роки тому

      - try using the 32 bit sdl files (i686-w64-mingw32) instead of the 64bit ones from the tutorial.
      - make sure your main function looks like: int main(int argc, char **argv) (remember no caps in main function eg mAin()).
      that's all i got hope it helps :D

    • @tiagodelgado1214
      @tiagodelgado1214 2 роки тому

      @@evolve-yt Hey! Can you explain why using the 32bit files works but not the 64bit?

  • @vrzxon
    @vrzxon Рік тому

    i hate setting up these
    main.cpp:1:10: fatal error: SDL2/SDL.h: No such file or directory
    1 | #include
    i

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому

      What version of everything are you using?

    • @vrzxon
      @vrzxon Рік тому

      ​@@SonarSystemsCoUk SDL2 2.26.5
      "includePath": [
      "${workspaceFolder}/**",
      "${workspaceFolder}/src/include"
      ],
      this in .json
      i think i did it right idk why it dont work

  • @wexnkie
    @wexnkie Рік тому +2

    thx for tutor
    Find video where man resolved
    undefined reference to `WinMain' problem by added
    #define SDL_MAIN_HANDLED
    in top of main.cpp file and it worked for me.

  • @82huyhoang71
    @82huyhoang71 Рік тому

    I am getting a fatal problem which is no such a file or directory

  • @khoidayy4242
    @khoidayy4242 Рік тому

    Hi, do you have any tips with how to turn on the main.exe 'cause it keeps getting "This application couldn't start properly"
    Pls help me:(

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому

      When does this occur, how are you trying to launch it?

  • @sreepriyacp5768
    @sreepriyacp5768 7 місяців тому

    Why it is saying missing separator when I use make

  • @9tales9faces
    @9tales9faces 4 місяці тому

    doing mingw32-make just...deleted main.cpp? what in the

  • @m_jdm357
    @m_jdm357 2 роки тому +2

    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
    I don't know what to say

    • @m_jdm357
      @m_jdm357 2 роки тому

      you left me speechless

    • @TheBoxingBinge
      @TheBoxingBinge 2 роки тому

      same for me

    • @DeltaEchoVictor
      @DeltaEchoVictor 2 роки тому

      run mingw32-get install mingw32-make
      go to C:\mingw\bin and replace wingw32-make with make

    • @huyenvu5642
      @huyenvu5642 Рік тому

      @@DeltaEchoVictor Could you provide me specific instructions?

  • @alexvierra1044
    @alexvierra1044 7 місяців тому

    if yall are having trouble with the #include try and just use #include this way worked for me, and I'm thinking that's how they now do it with 2.30 version.

  • @pepe6666
    @pepe6666 Рік тому +1

    you started the tutorial with already downloading the SDL dev file? yet telling people how to download visual studio? cmon man. it would be helpful if you explained why you got the mingw version, etc.

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому

      Why?

    • @marcus_lyn
      @marcus_lyn Рік тому

      ​@@SonarSystemsCoUk Have you already installed the gcc compiler? and you are using that instead of the visual c++ compiler? Theres missing info here

  • @MB-sn8nh
    @MB-sn8nh 7 днів тому

    does it work with c also ?

  • @shell4293
    @shell4293 Рік тому

    What if we want to use SDL2 on the X64 version, so that it can use more than 4gb of RAM? Surely this version would be better? How do I get an x64 version of MinGW to use it with?

  • @Zeb1947
    @Zeb1947 Рік тому

    when I type make in terminal make it gets errors, please help me

  • @spaidory874
    @spaidory874 Рік тому +1

    God bless you man

  • @nz-479
    @nz-479 Місяць тому

    what do you do
    man you have tons of petabyte still you're running outta space

  • @foxlanza
    @foxlanza Рік тому

    The realeases page is not working anymore, can someone help me?

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому

      What happens?

    • @foxlanza
      @foxlanza Рік тому

      @@SonarSystemsCoUk when you click "realeases" it takes you directly to github and after downloading the folder the "lib" folder is missing

  • @MilkyGamesOfficial
    @MilkyGamesOfficial Рік тому

    We're just gonna ignore the NFT folder?

    • @SonarSystemsCoUk
      @SonarSystemsCoUk  Рік тому

      What folder, first rule of folder club is we don't talk about folders

  • @LostInThoughtsAllAlone2
    @LostInThoughtsAllAlone2 2 роки тому +1

    make doesn't get recognized by terminal, i tried copy pastying Makefile command but i get the following error: skipping incompatible src/lib/libSDL2.dll.a when searching for -lSDL2...
    Any geniuses in the chat????????? seriously begging ,been stuck on this for a second day...

    • @johnnyl2903
      @johnnyl2903 2 роки тому +2

      I read "That message isn't actually an error - it's just a warning that the file in question isn't of the right architecture (e.g. 32-bit vs 64-bit, wrong CPU architecture). The linker will keep looking for a library of the right type.". So I instead of using the 32-bit folder, I followed all the instructions using the 64-bit folder.

    • @carlosjacinto8612
      @carlosjacinto8612 Рік тому

      @@johnnyl2903 Thank you. Now it worked.

  • @matheusfrank6500
    @matheusfrank6500 2 роки тому +1

    thanks bro, visual studio code is very powerfull.

  • @chemsochemso267
    @chemsochemso267 Рік тому

    include problem any solution?

  • @opslayer3472
    @opslayer3472 2 місяці тому

    How do you do it for C

  • @felliperibeiroteixeira
    @felliperibeiroteixeira Рік тому

    mine is giving undefined reference to SDL_Init, CreatWindow

  • @beejaycarlfrancisco3627
    @beejaycarlfrancisco3627 8 місяців тому

    its need to put the sdl bin into environment path?

  • @ygrub3869
    @ygrub3869 7 місяців тому

    You are the best

  • @ibrapro1031
    @ibrapro1031 2 роки тому

    hi problem make command is not working please can you help me

    • @em_raaa
      @em_raaa 2 роки тому

      if you are on windows 11 make sure you are using the 64 bit version

    • @em_raaa
      @em_raaa 2 роки тому

      of sdl