Install SDL2 on macOS Catalina

preview_player
Показать описание
How to install SDL2, SDL2_image, SDL2_mixer, SDL2_ttf and SDL2_net on macOS Catalina.

We use the Homebrew package manager. If you don't have Homebrew and the Command Line Tools installer, check my previous tutorial:

Installation commands used in the video:
brew install sdl2 sdl2_image sdl2_mixer sdl2_ttf sdl2_net
brew install pkg-config

Source code for the example SDL2 program:

Build/Compile commands used:
clang -std=c18 -Wall -pedantic test_sdl2.c -lSDL2
clang -std=c18 -Wall -pedantic test_sdl2.c `pkg-config --libs sdl2`
Рекомендации по теме
Комментарии
Автор

Thank you! I send you greetings from Argentina!

ernirrooychip
Автор

Thanks a lot man… You really saved my day!

garethgareth
Автор

PLEASE can you help me I have this error : fatal error: 'SDL2/SDL.h' file not found #include <SDL2/SDL.h>, I have installed brew and followed step by step but it doesn't work apparently, im on Macbook pro Big Sur

AntibioTak
Автор

How do you share you.games with others? Sharing the a.out file, will it run on other mac without sdl? Or do you need to share the sdl2.so with your a.out?

dapoint
Автор

Can you please tell difference between
-pedantic test_sdl2.c -lSDL2 VS. -pedantic test_sdl2.c `pkg-config --libs sdl2`. ?

jed.
Автор

What is the Build/Compile command for c++? I tried your test code and it worked perfectly fine. But when I tried my c++ test code it seemed like it was not working even though I did change clang to clang++ and -std=c18 to -std=c++11

QuynhNguyen-qcng
Автор

for some reason I get this error when I run it in terminal:
clang: error: no such file or directory: 'test_sdl2.c'

davross
Автор

I am trying to install SDL 1.2 on catalina. Should I do the same method as you did here?

kozookumura
Автор

What is the command for when I want to linkt SDL2_image and SDL2_tff to my project?

johnreimer
Автор

doesn't make sense, every time I type that in it says that brew isn't a command

EmmanuelT
Автор

Great idea.

Homebrew: the system that takes ownership of /usr/local.

Great idea if you don't understand things anyway...Oh and don't mind security problems.

xexyzxexyl
Автор

Everything works until I start running it on my terminal.

When running the vim test_sdl2.c command on a new terminal window, an error message is printed with E325: Attention. Found a swap file by the name ".test_sdl2.c.swp". It is also asking me to [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:

After trying O, E a new window is created with a lot of ~ under each other.

I am not sure what else to do with this. Could you provide some guidance as i am not sure how to link the GitHub file including the Code with my terminal window. I have the file downloaded. Some guidance would be appreciated.

nicholasgalea
join shbcf.ru