简体   繁体   English

找不到-lSDL的库

[英]Library not found for -lSDL

I am trying to compile a C++ program that uses SDL using the g++ compiler. 我正在尝试使用g ++编译器编译使用SDL的C ++程序。 I just downloaded SDL and put the SDL.framework into the /Library/Frameworks directory on my computer. 我刚刚下载了SDL,并将SDL.framework放入计算机上的/ Library / Frameworks目录中。 My compile line includes 我的编译行包括

-L/Library/Frameworks -lSDL  

This causes the error: 这会导致错误:

ld: library not found for -lSDL
clang: error: linker command failed with exit code 1

How can I get this to compile? 我该如何进行编译?

You have to use -framework SDL on OS X, not -lSDL (unless you install SDL as a library, which is also possible). 您必须在OS X上使用-framework SDL ,而不是-lSDL (除非也可以将SDL安装为库)。 You will also want -I/Library/Frameworks/SDL.framework/Headers , I think. 我想您还需要-I/Library/Frameworks/SDL.framework/Headers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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