简体   繁体   中英

compile a c++ SDL2 program using the gcc compiler on a mac

I have experience compiling using the gcc compiler on mac, windows, and linux systems and know how to compile will dll's in windows. In this instance, I want to compile a SDL2 program using a mac with the gcc compiler (I have done it on a windows machine); however, when you download the development libraries off the site they do not include any shared library files, only header files. I am currently just a computer science student so I am not the best programmer, if you could help me out compiling a simple SDL2 program showing me all the command prompt options and flags that would be great!

PS I do not want to use Xcode to get the job done

First copy the SDL2.framework in the .dmg to your ~/Library/Frameworks. Include the headers in your project #include <SDL2/SDL.h> .

You can then compile it by using:

gcc main.cpp -o main -F/Library/Frameworks -framework SDL2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM