How do you include files in C++ from the /Library/Framework folder in MAC

孤街醉人 提交于 2019-11-28 21:30:33
Grady Player

you will want to make a build script for this obviously, but the important parts are:

-I/usr/local/include or wherever your headers get installed.

I used home brew:

brew install sdl2

which puts the libraries in /usr/local/Cellar/

so if you need to specify the lib path you will also add:

-L/usr/local/lib -lSDL2

I also changed your include line to #include <SDL2/SDL.h>

Your header files is under the Headers folder, so in order to include this properly:

clang++ -std=c++11 -stdlib=libc++ -I/Library/Frameworks/SDL2.framework/Headers/

But I recommend Installing with homebrew:

brew install sdl2

Homebrew will install SDL2 libSDL2.a file under /usr/local/lib and /usr/local/include, so you will just need to include this Library path using the -L for library and -I flag to add search in /usr/local/include dir:

clang++ -std=c++11 -stdlib=libc++ main.cpp -I/usr/local/include -L/usr/local/lib -lSDL2 -o programfile

And include:

#include <SDL2/SDL.h>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!