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

  Рет қаралды 22,787

Independent Pixels

Independent Pixels

3 жыл бұрын

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/codingwithjulio/sd...
And.. don't forget to give a thumbs up and subscribe if you enjoyed this content :)

Пікірлер: 105
@ShicaiHe
@ShicaiHe 7 ай бұрын
Thank you so much, your tutorial is very clear and concise and with comfortable speed. And you have such an amazing voice!
@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?
@kilianlecalvez9473
@kilianlecalvez9473 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 9 ай бұрын
@@kilianlecalvez9473 I had exactly the same thing as yours, it still gives cannot find "ld: library not found for -lSDL2", darn it
@frogman1
@frogman1 Ай бұрын
@@kilianlecalvez9473 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 ".
@cappydino7162
@cappydino7162 2 жыл бұрын
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 2 жыл бұрын
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!
@darrenfinch1935
@darrenfinch1935 10 ай бұрын
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 8 ай бұрын
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
@MrDiamondsRubies
@MrDiamondsRubies Жыл бұрын
Awesome tutorial - everything was explained really well. Thank you!
@igor875126
@igor875126 2 жыл бұрын
Wow dude, you are explaining very well! immediately subscribed
@TopherGriffin
@TopherGriffin Жыл бұрын
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 Жыл бұрын
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!
@eric-jt
@eric-jt Жыл бұрын
Exactly what I was looking for. Thanks!
@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 KZfaq captions are overlapping sometimes the command-line.
@hyunyaa
@hyunyaa 2 жыл бұрын
Thank you so much. very helpful !
@aydieblake
@aydieblake Жыл бұрын
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 Жыл бұрын
Thanks for the feedback 👍 Yeah, the audio is not the best. I’ll improve it for the next videos 🙌
@skittles6949
@skittles6949 3 ай бұрын
Thank you so much!
@adomit9501
@adomit9501 3 жыл бұрын
Thank you ver much,it is wonderful video.hope the next video.
@hurstilthymy4943
@hurstilthymy4943 2 жыл бұрын
Awesome, thank you very much!
@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 2 жыл бұрын
You're welcome!
@quantondev
@quantondev 2 жыл бұрын
@@independentpixels actually. I find sdl so good. I will keep going with this. This is so fun
@independentpixels
@independentpixels 2 жыл бұрын
@@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 2 жыл бұрын
@@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 2 жыл бұрын
Wow, thanks so much! Amazingly clear and helpful tutorial! Please make some more SDL2 tutorials, you are great!
@independentpixels
@independentpixels 2 жыл бұрын
Thanks for this feedback :) I really appreciate it. Happy coding!
@yourmom6940
@yourmom6940 3 жыл бұрын
Great Video!! Earned a sub.
@oscarcastro01
@oscarcastro01 2 жыл бұрын
dude , you are a life saver
@independentpixels
@independentpixels 2 жыл бұрын
Glad I could help!
@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)
@sime_time
@sime_time 2 жыл бұрын
thank you
@ucanhbui4039
@ucanhbui4039 2 жыл бұрын
i have a problem when include sdl2_image. It is"sdl2_image not found". Could you help me with that please?
@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.
@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)
@alexsaves
@alexsaves Жыл бұрын
Could you update this for Ventura and current SDL2? So much has changed.
@ruscyber9765
@ruscyber9765 2 жыл бұрын
ld: library not found for -lsdl2
@gmamakoukas
@gmamakoukas 9 ай бұрын
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?
@atittulachan8803
@atittulachan8803 2 ай бұрын
can’t compile x86_64 version of libSDL under MacOS X using brew
@umairkhyam7675
@umairkhyam7675 2 жыл бұрын
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.
@LimboState7
@LimboState7 5 ай бұрын
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 2 ай бұрын
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.
@neodim4055
@neodim4055 2 жыл бұрын
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 2 жыл бұрын
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!
@meharjeetsingh5256
@meharjeetsingh5256 2 жыл бұрын
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 2 жыл бұрын
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 Жыл бұрын
@@independentpixels +1
@MrEdibles
@MrEdibles 9 ай бұрын
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 8 ай бұрын
hi! could you please help with solving this problem? i would be very thankful and happy if you could)
@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.
@akshatbisht2760
@akshatbisht2760 2 жыл бұрын
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 2 жыл бұрын
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 :)
@adfs774
@adfs774 Жыл бұрын
cannot open source file "SDL2/SDL_image.h" or cannot open source file "SDL2_image/SDL_image.h"
@stephanzoes8010
@stephanzoes8010 2 жыл бұрын
Hey for your COMPILER_FLAGS how do I switch out C++ for just C?
@independentpixels
@independentpixels 2 жыл бұрын
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.
@kollosal786
@kollosal786 2 жыл бұрын
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 2 жыл бұрын
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. 🤔
@vladvisnevski99
@vladvisnevski99 2 жыл бұрын
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'
@Johankelyn
@Johankelyn 2 жыл бұрын
I am having a problem when i want to include sdl2/sdl_image. Can you please help?
@independentpixels
@independentpixels 2 жыл бұрын
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?
@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
@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!
@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 Жыл бұрын
Command `make` only works when there is a Makefile in the particular path you're in. Check if you really have a `Makefile`.
@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!
@lolaueda8206
@lolaueda8206 2 жыл бұрын
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 2 жыл бұрын
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 2 жыл бұрын
Nice! I'm happy that you found the solution for the issue :) Happy coding!
@sharkpatrolheavyindustries
@sharkpatrolheavyindustries 9 ай бұрын
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. 🙏
@DerObernator
@DerObernator 2 жыл бұрын
thanks for the tutorial :) where can I find that vscode theme
@independentpixels
@independentpixels 2 жыл бұрын
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
@selfhelp441
@selfhelp441 Жыл бұрын
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 Жыл бұрын
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 ?
@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.
@everythingengineer7530
@everythingengineer7530 2 жыл бұрын
[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 2 жыл бұрын
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"
@soto1638
@soto1638 6 ай бұрын
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 3 ай бұрын
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 11 ай бұрын
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 9 ай бұрын
same problem, did you figure it out?
@JurgenHabermas_EU
@JurgenHabermas_EU 8 ай бұрын
same here, have you guys figured it out? i would be very happy and thankful @@jonahreisner8044
Making a Game With C++ and SDL2
5:34
Goodgis
Рет қаралды 602 М.
The Clever Way to Count Tanks - Numberphile
16:45
Numberphile
Рет қаралды 705 М.
小蚂蚁被感动了!火影忍者 #佐助 #家庭
00:54
火影忍者一家
Рет қаралды 34 МЛН
НРАВИТСЯ ЭТОТ ФОРМАТ??
00:37
МЯТНАЯ ФАНТА
Рет қаралды 8 МЛН
12 VS Code Extensions to INCREASE Productivity 2024
27:13
Devression
Рет қаралды 619 М.
I Made a Graphics Engine
6:42
Zyger
Рет қаралды 247 М.
Why The Windows Phone Failed
24:08
Apple Explained
Рет қаралды 241 М.
Introduction to CMake Crash Course
14:08
PunchedTape
Рет қаралды 13 М.
I turned Programming into a Game
8:49
FaceDev
Рет қаралды 89 М.
Learning SDL2 in 48 Hours - GMTK Game Jam 2020
9:19
PolyMars
Рет қаралды 3,1 МЛН
Compilers, How They Work, And Writing Them From Scratch
23:53
Adam McDaniel
Рет қаралды 135 М.
BEST WAY to make Desktop Applications in C++
26:00
The Cherno
Рет қаралды 900 М.
Let's Program Doom - Part 1
25:13
3DSage
Рет қаралды 416 М.
小蚂蚁被感动了!火影忍者 #佐助 #家庭
00:54
火影忍者一家
Рет қаралды 34 МЛН