How to Setup SDL2 and VSCode to Start Programming OpenGL on a Mac

  Рет қаралды 24,677

Independent Pixels

Independent Pixels

Күн бұрын

In this tutorial we’ll create a SDL2 starter project using VSCode on a Mac.
#Game #SDL2 #2D #OpenGL
By the end of this tutorial you will have...
A SDL2 project template to start learning OpenGL.
Installation of SDL2 and SDL2_image libraries.
Set up and linking of the libraries to the project.
Set up of VSCode to enable debugging your application.
Playlist: • OpenGL
Where to go from here? Check this tutorial on how to create a window using SDL2 - • How to Create a SDL2 W...
Resources:
SDL website: www.libsdl.org
SDL2-Starter project on GitHub: github.com/cod...
And.. don't forget to give a thumbs up and subscribe if you enjoyed this content :)

Пікірлер: 108
@cappydino7162
@cappydino7162 3 жыл бұрын
Thank you so much! I spent over an hour trying to figure out how to set up SDL2 on mac, and then after I found your video, I did it in twenty minutes!
@independentpixels
@independentpixels 3 жыл бұрын
Cool! I'm happy to hearing that! Doing setups is tedious and sometimes we get weird errors. I'm glad this helped you. I'm adding some other tutorials about the basics of SDL2 and over time I'll evolve to tutorials on how to create some small games and eventually more complex games :) If you have some time, check those out as well. Happy coding!
@u9refion1
@u9refion1 2 жыл бұрын
FOR EVERYONE RUNNING INTO ERROR: "ld: library not found for -lsdl2" I was able to fix it by including the full path to each /lib/ directory in the LIBRARY_PATHS as such: LIBRARY_PATHS = -L/opt/homebrew/Cellar/sdl2/2.0.22/lib/ -L/opt/homebrew/Cellar/sdl2_image/2.0.5/lib All together this gave me the following command line prompt: g++ -std=c++11 -Wall -O0 -g -lsdl2 -lsdl2_image -Iinclude -L/opt/homebrew/Cellar/sdl2/2.0.22/lib/ -L/opt/homebrew/Cellar/sdl2_image/2.0.5/lib src/main.cpp -o build/debug/play Hope this solves it for you guys as well! :)
@ucanhbui4039
@ucanhbui4039 2 жыл бұрын
i try your way but i still have a problem when include sdl2_image and sdl2_ttf . It is"sdl2_image not found". Could you help me with that please?
@Proplaysmobilegame
@Proplaysmobilegame 2 жыл бұрын
@@ucanhbui4039 I used different -L -I than in the video and it works for me : INCLUDE_PATH = -I include/SDL2 -I include/SDL2_image LIBRARY_PATH = -L lib/SDL2 -L lib/SDL2_image LINKER_FLAGS = -lSDL2 -lSDL2_image The reason why is that -lSDL2 does not give me the symbols i need so i add the -L for sdl2_image AND I precise every include path beacause in the original source code in SDL2_image.h, the include is not SDL2/SDL.h but SDL.h Here are my tree for the symbolic links : ├── include │ ├── SDL2 -> /opt/homebrew/Cellar/sdl2/2.0.22/include/SDL2 │ └── SDL2_image -> /opt/homebrew/Cellar/sdl2_image/2.0.5/include/SDL2 ├── lib │ ├── SDL2 -> /opt/homebrew/Cellar/sdl2/2.0.22/lib │ ├── SDL2_image -> /opt/homebrew/Cellar/sdl2_image/2.0.5/lib Much thanks to this guy video it's super clean and clear did not found something as this as good on the net, KEEP GOING WELL PLAYED
@minruilu1362
@minruilu1362 Жыл бұрын
@@Proplaysmobilegame I had exactly the same thing as yours, it still gives cannot find "ld: library not found for -lSDL2", darn it
@frogman1
@frogman1 5 ай бұрын
@@Proplaysmobilegame thank you so much! this pretty much fixed all the issues i had. i also had to change the include code to look like "#include ".
@darrenfinch1935
@darrenfinch1935 Жыл бұрын
THANK YOU! This was the first tutorial that actually got SDL working on my Mac. Did not know you could install SDL with Homebrew, and I definitely did not think of doing symlinks to link to the SDL libraries. Great job!
@JurgenHabermas_EU
@JurgenHabermas_EU Жыл бұрын
could you please tell me what version of mac os you have, because for some reason this solution does not apply to mac os 14
@TopherGriffin
@TopherGriffin 2 жыл бұрын
I feel an SDL2 walkthrough from here would boost your channel so much! I had tried to follow another walkthrough and stumbled at the first issue of not being able to run CodeBlocks. Then tried another which was Eclipse based on linux and couldn't get the linker to work. Then last before finding this, I tried a vs code solution for windows, which didn't work. This finally popped up in my suggested and was the first time I saw a MacOS solution for SDL and it works! Thank you so much, please consider making more content for your channel. Your guidance is just the right level of information - not too much, not too little, and its robust!
@independentpixels
@independentpixels 2 жыл бұрын
Hey Toffy, thanks a lot for leaving this feedback. I have been super busy at my full time job and didn’t have much time to create new videos, although I still want to explorer more SDL and create some small games with it. I’m happy that this tutorial was useful to you. I hope you come back later to watch new videos when I post them. Cheers!
@ShicaiHe
@ShicaiHe 11 ай бұрын
Thank you so much, your tutorial is very clear and concise and with comfortable speed. And you have such an amazing voice!
@aydieblake
@aydieblake 2 жыл бұрын
Great video, super clear and easy to follow! Wish I watched this before struggling for hours to get VS Code working with SDL on my Mac. Only thing I would suggest is boosting your audio volume, it's pretty quiet even with my volume all the way up.
@independentpixels
@independentpixels 2 жыл бұрын
Thanks for the feedback 👍 Yeah, the audio is not the best. I’ll improve it for the next videos 🙌
@IONYVDFC
@IONYVDFC Жыл бұрын
Brilliant approach, this video not only got me to the goal; it also clearly shows best practice linking libraries every time you want to include it in your project. I did not know the ability of the 'tree' command to show the actual links, this video really made my day. My only comment is readability; My eyesight is not bad, though, I need to use accessibility options to read the command-line, and KZbin captions are overlapping sometimes the command-line.
@quantondev
@quantondev 3 жыл бұрын
Thank you so much. This is the only tutorial that gets sdl2 to work on mac properly. Now I can fly trough
@independentpixels
@independentpixels 3 жыл бұрын
You're welcome!
@quantondev
@quantondev 3 жыл бұрын
@@independentpixels actually. I find sdl so good. I will keep going with this. This is so fun
@independentpixels
@independentpixels 3 жыл бұрын
@@quantondev Yes, indeed. It's really nice to work with SDL2 even though it's an old API. I didn't have time yet, but I'm planning to share new tutorials on how to work with SDL2 APIs for things like reading files, loading and playing sounds, rendering elements on the screen based on tilemaps, etc. Also, I'm planning to create a series where we will be able to recreate Pacman using SDL2. That will be also fun :) Have fun, and if you create something that you want to share, feel free to upload it to youtube and share it here in the comments. Stay creative, and have fun.
@quantondev
@quantondev 3 жыл бұрын
@@independentpixels haha thanks. I am working on dialog bubbles to start with. I would like to share it after it finishes. It is not that easy to create an entity object to relate each other for now. I am trying to find a good way to deal with it. Looking for other projects as well. I will be back in couple of days :)
@BackForwardPunch
@BackForwardPunch 3 жыл бұрын
Wow, thanks so much! Amazingly clear and helpful tutorial! Please make some more SDL2 tutorials, you are great!
@independentpixels
@independentpixels 3 жыл бұрын
Thanks for this feedback :) I really appreciate it. Happy coding!
@igor875126
@igor875126 2 жыл бұрын
Wow dude, you are explaining very well! immediately subscribed
@eric-jt
@eric-jt 2 жыл бұрын
Exactly what I was looking for. Thanks!
@MrDiamondsRubies
@MrDiamondsRubies Жыл бұрын
Awesome tutorial - everything was explained really well. Thank you!
@human-j8r
@human-j8r Жыл бұрын
At 4:53, there is no `sdl2_image1 directory present for me, even though I followed your instructions to this point. Anyone else experienced that?
@alexsaves
@alexsaves Жыл бұрын
Could you update this for Ventura and current SDL2? So much has changed.
@JohnHwang-w2m
@JohnHwang-w2m Ай бұрын
Hi, thank you for your video, it helps me a lot, and I'm curious what theme you use in this video for your VSCode :D it looks good
@LimboState7
@LimboState7 9 ай бұрын
For those who still receive the following error : "ld: library not found for -lsdl2" Installing using "brew install sdl2" has a new default path as of 2024 which is /opt/homebrew/Cellar Instead of creating a symlink (ln -s command) between the path (/opt/homebrew/Cellar) and your project directory, simply copy the files to your directory. This can be done with the following command: cp -r /opt/homebrew/Cellar/sdl2/2.30.0/include/SDL2 [your project path] cp -r /opt/homebrew/Cellar/sdl2/2.30.0/lib [your project path] For sdl2_image I didn't encounter any errors when creating a symlink(ln -s command). If you receive a similar error for sdl2_image, follow the same steps above. Otherwise follow the video above. Hope this helps :)
@PuffyNutty
@PuffyNutty 6 ай бұрын
So I copied all the files into their directories, yet the same error still appears (ld: library 'sdl2' not found). Any idea what I'm doing wrong? My Tree: . ├── Makefile ├── build │ └── debug ├── include │ ├── SDL2 (copied directly from Cellar) │ └── SDL2_image (copied directly from Cellar) ├── lib │ └── lib (SDL2_image library copied directly from Cellar) └── src └── main.cpp I renamed "SDL2_image" in the include folder from its previous name "SDL2", as two folders with the same name cannot exist together. I don't think this would impact anything, as the header inside does not reference the folder's name. Edit: I somehow did it. The video showed that the lib folder needed to be taken from SLD2_image. Instead, I replaced it with the lib folder from SLD2, and it worked.
@ruscyber9765
@ruscyber9765 2 жыл бұрын
ld: library not found for -lsdl2
@freezingstream6594
@freezingstream6594 Жыл бұрын
Sir Thank you for your video. I have one major problem. When I am pressing debug as you did at 19:23 the terminal gives me the following error: Starting build... make spawn /bin/sh ENOENTBuild finished with error(s). * The terminal process failed to launch (exit code: -1). * Terminal will be reused by tasks, press any key to close it. Please how do I fix this Thank you
@freezingstream6594
@freezingstream6594 Жыл бұрын
I fixed my own problem. For anyone else having this problem, just double check your launch.json and tasks.json files if they are written exactly as the video described! I had a slight bracket error.
@adomit9501
@adomit9501 3 жыл бұрын
Thank you ver much,it is wonderful video.hope the next video.
@MrEdibles
@MrEdibles Жыл бұрын
The fastest fix for the "ld: library not found for -lsdl2" error would be to just chanbge -Llib to "-Llib/SDL2" - this is assuming you made a sym-link to your project/lib and there is a folder names SDL2 in there. You could also just copy the libraries into the lib folder directly and it would work as is.
@JurgenHabermas_EU
@JurgenHabermas_EU Жыл бұрын
hi! could you please help with solving this problem? i would be very thankful and happy if you could)
@319nsor3
@319nsor3 Жыл бұрын
Thank so much you are the best I like your videos I have question, when I make a new project I should to do like first time or there is a kinda template, thank for your help.
@meharjeetsingh5256
@meharjeetsingh5256 3 жыл бұрын
Thanks man I love you for making this video, but as a beginner I don’t really understand the whole concept around (Makefile and json files) can you please make some videos like this for those topics as well
@independentpixels
@independentpixels 3 жыл бұрын
Hey thanks for investing your time to watch the video :) Sure, I like your suggestion. I can definitely do some videos explaining what those files are, etc. Thanks for your suggestion.
@selfhelp441
@selfhelp441 2 жыл бұрын
@@independentpixels +1
@hyunyaa
@hyunyaa 3 жыл бұрын
Thank you so much. very helpful !
@dev.with.Nguyen
@dev.with.Nguyen Жыл бұрын
It's great video. But can I ask a question? if I ignore LINKER_FLAGS in Makefile, my program can run? (I test it but when I import LINKER_FLAGS, vscode says: no such file or directory: lsdl2)
@atittulachan8803
@atittulachan8803 6 ай бұрын
can’t compile x86_64 version of libSDL under MacOS X using brew
@bigmancozmo
@bigmancozmo 3 жыл бұрын
19:10 *edit: i've noticed it's happening with "#include " pls help im getting an error it say: g++ -std=c++11 -Wall -O0 -g -lsdl2 -Iinclude -Llib src/main.cpp -o build/debug/play ld: warning: dylib (/usr/local/lib/libsdl2.dylib) was built for newer macOS version (11.0) than being linked (10.15.6) Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable (maybe you meant: SDL_main()) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [all] Error 1
@independentpixels
@independentpixels 3 жыл бұрын
Hi, it seems that you don't have a main() method defined in your main.cpp file. Make sure your main.cpp file has a main() method like this: github.com/jcfausto/sdl2-starter/blob/36f49bdd8b46ae4e3d49a6ef16dd75b94037f81a/src/main.cpp#L4 You can copy the entire content of the main.cpp file from the link above just to be sure everything is alright. I believe that this should fix the problem :) From there, you can then start adding more code to your program/game. Happy coding!
@RealtyTaj
@RealtyTaj 2 жыл бұрын
I don't have a g++ build and debug active file: 13:14 . Why is that happening?
@RealtyTaj
@RealtyTaj 2 жыл бұрын
I do get a launch.json file, but not with all the tags that are in your video
@prodbytukoo
@prodbytukoo 2 жыл бұрын
Hi! I've tried using glfw but the version my mac uses is openGL 2.3, and shaders are not available. Doing this procedure will work? (I'm using a M1 macbook)
@kollosal786
@kollosal786 3 жыл бұрын
Using Apple's silicon puts installs the library to /opt/homebrew/* I got this error after following everything : ld: library not found for -lsdl2 will update if I got any progress
@independentpixels
@independentpixels 3 жыл бұрын
Unfortunately I don't have a M1 to ensure the project will work on both processors. I'm starting to think that maybe having the libraries added to the project directly would be a better option that would fit for all cases. 🤔
@hurstilthymy4943
@hurstilthymy4943 3 жыл бұрын
Awesome, thank you very much!
@umairkhyam7675
@umairkhyam7675 3 жыл бұрын
Hi can you please make a video on how we can install SDL BGI on mac
@cemugurkaracam
@cemugurkaracam 3 жыл бұрын
That's wonderful! I was trying to get into sdl2 but it looks like Raylib is more beginner friendly for new c++ learners. Could you make another for the Raylib(c++) on macOS + vscode ?
@independentpixels
@independentpixels 3 жыл бұрын
Thanks :) Yes, SDL2 is not super beginner friendly. The Raylib seems to be a great alternative indeed. I'll try to create another version of this setup using Raylib instead of SDL2.
@cemugurkaracam
@cemugurkaracam 3 жыл бұрын
@@independentpixels Great news! I'll be waiting, thanks again.
@thuy9435
@thuy9435 2 жыл бұрын
This is what i get when i run the terminal "make" make: *** No targets. Stop. Can you take a look and help me fix it? Thank you so much
@carlosiebenschuh3608
@carlosiebenschuh3608 2 жыл бұрын
Command `make` only works when there is a Makefile in the particular path you're in. Check if you really have a `Makefile`.
@skittles6949
@skittles6949 7 ай бұрын
Thank you so much!
@adfs774
@adfs774 Жыл бұрын
cannot open source file "SDL2/SDL_image.h" or cannot open source file "SDL2_image/SDL_image.h"
@everythingengineer7530
@everythingengineer7530 3 жыл бұрын
[resolved, FYI] On 2021 M1 imac, I had error when attempting to run the debugger (16:30): "Warning: Debuggee TargetArchitecture not detected, assuming x86_64. ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (attach failed ((os/kern) invalid argument)) The program '/Users/kevin/repos/learnOpenGL/build/debug/play' has exited with code 42 (0x0000002a)." I was able to resolve this by adding extension "CodeLLDB," then changing launch.json from ""type": "cppdbg"" to ""type": "lldb""
@independentpixels
@independentpixels 3 жыл бұрын
Hey Everything Engineer, I'm glad you fixed it. Thanks for sharing the solution here. It might be helpful to other colleagues as well. 👍
@ucanhbui4039
@ucanhbui4039 2 жыл бұрын
Could you include SDL2 on mac m1? I had an error: "cannot open source file "SDL2/SDL.h"
@oscarcastro01
@oscarcastro01 3 жыл бұрын
dude , you are a life saver
@independentpixels
@independentpixels 3 жыл бұрын
Glad I could help!
@sime_time
@sime_time 2 жыл бұрын
thank you
@akshatbisht2760
@akshatbisht2760 3 жыл бұрын
when I use 'make' command in terminal of vscode, it gives the following error: g++ -std=c++11 -Wall -O0 -g -lsdl2 -Iinclude -Llib src/main.cpp -o build/debug/play ld: library not found for -lsdl2 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [all] Error 1 It doesn't make any 'play' file inside 'debug' as well. I have made alias of both 'include' and 'lib' file properly.
@independentpixels
@independentpixels 3 жыл бұрын
Hey akshat, Could you please share what's the output of `brew info sdl2`? It will tell us where you have SDL2 installed on your machine. The path indicated, should match the one in the links. Could you also share please the output of (from the project directory): $ la lib/ $ la include/ With this info I might be able to help you :)
@dev_web3903
@dev_web3903 2 жыл бұрын
Hey man thank you so much this tutorial was super helpful. I'm just still a little confused about the relationship between SDL and OpenGL. I'm interested in making 3D graphics, so I was wondering what additional libraries I need to do that.
@independentpixels
@independentpixels 2 жыл бұрын
Hey dev_web, I'm glad you liked it :) SDL is a library that was created to facilitates the access to operating system resources such as audio, keyboard, video, joysticks, gamepads, and graphic resources either through OpenGL or Direct3D. It simplifies a lot the code necessary to perform some action, like creating a window, which would be different if you're creating it on Windows, Linux, or Mac. In order to create 3D graphics, my current understanding is that you'll have to use OpenGL sooner or later. You can definitely you SDL and OpenGL in combination, that won't be a problem. In the SDL's official tutorials page there are some examples about how to use SDL with OpenGL: wiki.libsdl.org/Tutorials Also, I'd recommend having a look at other libraries as well like GLFW or GLEW, they're as also very good libraries and I think I'd choose one of these if I wanted to create 3D games or so. Happy learning!
@dev_web3903
@dev_web3903 2 жыл бұрын
@@independentpixels ok cool thank you, it makes a lot more sense now. So in theory, if I install the glew and glfw libraries and link them to my include folder on the build I should be able to use them? I’m assuming my .json files will have to be a little different as well?
@independentpixels
@independentpixels 2 жыл бұрын
@@dev_web3903 I'm not 100% sure, but I think that the same process would work. I was reading briefly the GLFW docs and it seems that once you download and unzip the library all you have to do is to link to the folder containing the headers and the libs. So, in theory, the same approach I used on this tutorial should work. If that does not work, then and alternative is to copy the folders containing the headers files directly into to your project. That's also a common practice. :)
@dev_web3903
@dev_web3903 2 жыл бұрын
@@independentpixels Ok awesome I'll give it a try, thank you for your help it is much appreciated.
@stephanzoes8010
@stephanzoes8010 3 жыл бұрын
Hey for your COMPILER_FLAGS how do I switch out C++ for just C?
@independentpixels
@independentpixels 3 жыл бұрын
Hey, I'm not entirely sure about how to achieve that as I'm writing the programs in C++. But, I think that first you'll have to rewrite some parts that are using c++ specific features to use C features. Then, compiling will be similar to what we are doing now, except that you'll invoke a different compiler "gcc" instead of "g++" and for the flags you can remove the "-std=c++11" flag. I think that should do. I can't provider more details as I'm not an expert in C. I hope this helped anyways. Thanks.
@Johankelyn
@Johankelyn 3 жыл бұрын
I am having a problem when i want to include sdl2/sdl_image. Can you please help?
@independentpixels
@independentpixels 3 жыл бұрын
Hey Johan, what's exactly the problem you're having? Could you please tell me more details about what's not working and in case an error message is presented to you, what does it says?
@neodim4055
@neodim4055 3 жыл бұрын
For some reasons why I try to use anything that includes SDL_image it says i need the compiler flag -lSDL_Image, which i set, but the i get "library not found for -lSDL_Image". I have no clue as to why this happens. Could you help me out?
@independentpixels
@independentpixels 3 жыл бұрын
Hey, sorry for the late reply. In this case, I'd double check the setup of the library in your project. First: Check in the /lib folder of the project that an SDL2_image directory exists and that you can expand its content. Second: If the first check pass, then check the /include directory, and verify the the SDL2_image folder exists and that you can expand its content, which should include the SDL2_image.h file only. If one of the checks above fail, I'd suggest you to re-do the setup of this library as explained in the video. Third: Assuming you're using the make command to build the project, make sure that in the Makefile's LINKER_FLAGS you have both the -lsdl2 -lsdl2_image libraries required. The output of the make command should be something like this: g++ -std=c++11 -Wall -O0 -g -lsdl2 -lsdl2_image -Iinclude -Llib src/main.cpp -o build/debug/play One last tip: Sometimes the installation path for the SDL2 libraries could be different in your machine. The links for the /lib folder on the sample project were created assuming that the SDL2 libraries are physically installed on your machine on the "/urs/local/Cellar" directory. If that's not the case, then you'll have to adjust the links. In order to check where the libraries are installed, you can use the command: "brew info sdl2_image" I hope that helps :) Happy coding!
@vladvisnevski99
@vladvisnevski99 3 жыл бұрын
hi , i get this error, "clang: error: unknown argument: '-00' make: *** [all] Error 1" while running "make" from terminal any ideas how to solve that/
@RealtyTaj
@RealtyTaj 2 жыл бұрын
The flag is '-O0'
@DerObernator
@DerObernator 3 жыл бұрын
thanks for the tutorial :) where can I find that vscode theme
@independentpixels
@independentpixels 3 жыл бұрын
Hey, I'm glad you liked it :) The theme name is Cyberpunk and you can find it on this link here marketplace.visualstudio.com/items?itemName=max-SS.cyberpunk
@lolaueda8206
@lolaueda8206 3 жыл бұрын
Hi Julio, Could you please help with below error....? g++ -std=c++11 -Wall -O0 -g -lsdl2 -Iinclude -Llib src -o build/debug/play ld: can't map file, errno=22 file 'src' for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [all] Error 1
@lolaueda8206
@lolaueda8206 3 жыл бұрын
I found the issue in Makefile, after we complete the line, there should be no spaces before we move to the next line.
@independentpixels
@independentpixels 3 жыл бұрын
Nice! I'm happy that you found the solution for the issue :) Happy coding!
@sharkpatrolheavyindustries
@sharkpatrolheavyindustries Жыл бұрын
wherever you are, thank you for this post. was losing my mind over this error and it ended up being a trailing space like you said. 🙏
@andrepereira1807
@andrepereira1807 2 ай бұрын
good video but the console font is really small
@ohlorduser
@ohlorduser 2 жыл бұрын
Hello I am having issues with the Debugging Aspect (everything else works fine). My breakpoints are changed into gray hollow circles when I run the debugger. Looking on VSCode's website: "When a debugging session starts, breakpoints that cannot be registered with the debugger change to a gray hollow circle. The same might happen if the source is edited while a debug session without live-edit support is running." Anyone have any clue what I am doing wrong? Let's say my Makefile,tasks and launch are correct
@ohlorduser
@ohlorduser 2 жыл бұрын
Okay so I got it to work BUT the literal only thing I did was in the "launch.json" - my version was on the bottom so I moved it on the top like yours....
@independentpixels
@independentpixels 2 жыл бұрын
@@ohlorduser Awesome! Great to hear that you fixed the issue 👍Happy coding!
@selfhelp441
@selfhelp441 2 жыл бұрын
really nice video, had a few questions i was hoping you might be able to clear up! do you typically use brew to install you libraries? how come you didn’t add a lib file for the standard sdl2 and only the sdl_image to your project? does sdl2 only need headers(?) when you added the sdl2 location to the include folder would this still be considered static linking? if you were to add more libraries to your project how would you change the makefile? (sorry if some of these seem silly, still trying to get my head around setting up c++ projects!)
@selfhelp441
@selfhelp441 2 жыл бұрын
also looking at the symlinking stuff you've done, how come the command was ln -s /usr/local/Cellar/sdl2/2.24.1/includeSDL2 ./include/SDL2 and not ln -s /usr/local/Cellar/sdl2/2.24.1/include/SDL2 ./include/SDL2 ?
@Penguins688
@Penguins688 7 ай бұрын
I guess I already had sdl2 installed?
@soto1638
@soto1638 10 ай бұрын
Unfortunately, I can't read the commands. Real pity. =(
@maxmlr724
@maxmlr724 3 жыл бұрын
I don't reach to install sdl2 with brew
@independentpixels
@independentpixels 3 жыл бұрын
Hi Max, what I usually recommend is to google search the issue you're having. Usually an answer will pop up in the search results. I can try to help if you share what specific error you're facing.
@maxmlr724
@maxmlr724 3 жыл бұрын
@@independentpixels I got many errors when I used the command ? Do you have a email or something to chat ? That's will be better
@silversrc
@silversrc 2 жыл бұрын
Dont know if your still accepting questions but, i keep getting this error when trying to use a SDL2_image function g++ -std=c++11 -Wall -O0 -g -lsdl2 -Iinclude -Llib src/main.cpp src/renderwindow.cpp -o build/debug/play Undefined symbols for architecture x86_64: "_IMG_Init", referenced from: _main in main-3bc8c0.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [all] Error 1 i really don't know what's causing this, any help would be appreciated
@independentpixels
@independentpixels 2 жыл бұрын
Hey :) Could it be that you need to add the linker flag -lsdl2_image to your makefile? The command to compile should look like this: g++ -std=c++11 -Wall -O0 -g -lsdl2 -lsdl2_image -Iinclude -Llib src/main.cpp src/renderwindow.cpp -o build/debug/play Also, you should make sure the the symbolic links are correc in the "/Lib" folder of the project. Sometimes the location where the libraries are installed on your machine may differ. Some other folks had similar issues. Have a look at some of the older comments down below, you might find your answer there. I hope that helps. Happy coding :)
@cantipi4337
@cantipi4337 7 ай бұрын
Hi.When I try to use "make" command, I get g++ -std=c++11 -Wall -O0 -g -lsdl2 -Iinclude -Llib src/main.cpp -o build/debug/play ld: library 'sdl2' not found message. Can anyone help me?
@c3vette47
@c3vette47 Жыл бұрын
the first test build of main.cpp I get an error -> g++ -std=c++11 -Wall -O0 -g -lsdl2 -Iinclude -Llib src/main.cpp -o build/debug/play ld: library not found for -lsdl2 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [all] Error 1 Any help would be greatly appreciated. Thank you!
@jonahreisner8044
@jonahreisner8044 Жыл бұрын
same problem, did you figure it out?
@JurgenHabermas_EU
@JurgenHabermas_EU Жыл бұрын
same here, have you guys figured it out? i would be very happy and thankful @@jonahreisner8044
@ucanhbui4039
@ucanhbui4039 2 жыл бұрын
i have a problem when include sdl2_image. It is"sdl2_image not found". Could you help me with that please?
Learning SDL2 in 48 Hours - GMTK Game Jam 2020
9:19
PolyMars
Рет қаралды 3,1 МЛН
Чистка воды совком от денег
00:32
FD Vasya
Рет қаралды 4,9 МЛН
Мама у нас строгая
00:20
VAVAN
Рет қаралды 12 МЛН
Making a Game With C++ and SDL2
5:34
Goodgis
Рет қаралды 653 М.
Making a Game With C++ and SDL2
8:14
PolyMars
Рет қаралды 1,7 МЛН
2 Years Of Learning C | Prime Reacts
22:24
ThePrimeTime
Рет қаралды 314 М.
How to add SDL2 in Visual studio code!! Fix all errors!!
7:11
Afisn Drivs
Рет қаралды 14 М.
you NEED to use VS Code RIGHT NOW!!
12:48
NetworkChuck
Рет қаралды 580 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 734 М.
NVChad - Turn Neovim Into An Awesome IDE
14:48
Mental Outlaw
Рет қаралды 293 М.
Everything You Need to Know about Debugging in VSCode
7:02
ArjanCodes
Рет қаралды 45 М.
Writing 2D Games in C using SDL by Thomas Lively
47:32
CS50
Рет қаралды 190 М.