最近刚刚开始玩xcode,对着教程学编程时很少要动到项目设置,但昨天晚上想使用freetype验证上篇博文的问题,就需要设置include和lib路径了。

首先我下了freetype的源码,并在本地编译安装:

$ cd freetype-2.6
$ ./configuration
$ make check
$ make install

很顺利。

直接新建一个命令行的project,贴入代码 - 编译,就会得到如下编译错误:

找不到头文件,应该是没有把ft2build.h所在的路径添加到include path中来,找到代码的Build Settings,找到Header Search Paths,把freetype相关头文件所在路径加进去,如下:

很显然下面那行Library Search Paths也是需要的:

再次编译,发现还是有链接错误:

Undefined symbols for architecture x86_64:
"_FT_Init_FreeType", referenced from:
_main in main.o
"_FT_New_Face", referenced from:
_main in main.o
"_FT_Set_Pixel_Sizes", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code (use -v to see invocation)

一定是没有指定freetype的lib文件。这个设置和VisualStudio下的不太一样,需要直接设置链接参数。我去/usr/local/lib下找到多个和freetype相关的文件:

libfreetype..dylib
libfreetype.a
libfreetype.dylib
libfreetype.la

经过反复试验,应该填-lfreetype:

写几行使用freetype的代码,终于可以编过了!

#import <Foundation/Foundation.h>
#import <ft2build.h>
#include FT_FREETYPE_H int main(int argc, const char * argv[]) {
@autoreleasepool { FT_Library library;
FT_Face face;
int error = ; if (FT_Init_FreeType(&library)){
printf("1\n");
return ; /* leave it uninitialized */
} error = FT_New_Face( library, "/System/Library/Fonts/Apple Color Emoji.ttf", , &face );
if(error){
printf("2:error=%d\n", error);
return ;
} error = FT_Set_Pixel_Sizes(face, , );
if (error) {
printf("3:error=%d\n", error);
} // insert code here...
NSLog(@"Hello, World!");
}
return ;
}

在xcode中设置include和lib路径的更多相关文章

  1. XCode中设置字体大小

    XCode中设置字体大小 1)打开Preferences,快捷键是“Command + ,”(注意,是三个键,按住command键,然后再快速地按“+”和“,”两个键即可) 2)选择“Fonts &a ...

  2. 如何找出Xcode中不同版本Swift的路径

    我们知道Xcode中可能包含不知一个Swift的版本,那么我们如何找到它们对应的路径呢? 熟悉unix shell命令的童鞋都知道有一个find指令,在我们已知Xcode路径时,我们可以在其中找到Sw ...

  3. (转)Xcode 中设置部分文件ARC支持

    ARC是什么 ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting).简单地说,就是代码中自动加入了retain/release,原先需要手动添加的 ...

  4. Xcode 中设置部分文件ARC支持

    ARC是什么 ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting).简单地说,就是代码中自动加入了retain/release,原先需要手动添加的 ...

  5. gdal库中设置prj4库全路径的用法

    作者:朱金灿 来源:http://blog.csdn.net/clever101 gdal库实现投影转换之类的功能实际上底层都是调用prj4库的功能.如果gdal使用非静态的方式集成prj4库,实际上 ...

  6. ios开发xcode中设置代码块

    在开发中有很多重复的代码,很多开发者把常用的代码做成代码块提高开发效率. 在xcode里选中代码块的时候总是很不容易,点击选中的代码(文字),不要移动和松开鼠标左键,当竖线变成像拉长了的x(我也不知道 ...

  7. 删除xcode中的描述文件的路径

    打开Finder  commend + shift +g 进入文件夹  : ~/Library/MobileDevice/Provisioning Profiles  删除即可

  8. Xcode中设置按钮在十分钟之内禁用

    btn.enabled=NO;` NSTimer * notificationTimer = [NSTimer scheduledTimerWithTimeInterval:10*60.0 targe ...

  9. Xcode 常用设置

    1.main 文件注释 1)main 文件注释修改路径 /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Proje ...

随机推荐

  1. jmeter 多压力机并发测试过程

    要实现多台压力机并发,就必须有多台服务器上安装了jmeter程序包,首先把一台服务器作为主压力机,测试脚本放到这台机器上,主压力机与从压力机在同一局域网中,服务器之间可以ping通 第一步:在linu ...

  2. input 限制输入

    只能输入数字 :<input type="text" onkeyup="value=value.replace(/[^\d]/g,'')" /> 只 ...

  3. 使用jquery执行ajax

    $.ajax():返回其创建的XMLHttpRequest对象 回调函数:如果要处理$.ajax()得到的数据,则应该使用回调函数!beforeSend:在发送请求之后调用,需要一个XMLHttpRe ...

  4. codeforces 637A A. Voting for Photos(水题)

    题目链接: A. Voting for Photos time limit per test 1 second memory limit per test 256 megabytes input st ...

  5. 8个Javascript小技巧,让你写的代码有腔调

    如果你想确保你的JavaScript在大多数浏览器和移动设备中都可以工作,那么我从大漠等大神指导,原来可以使用f2etest,也可以使用Endtest,browserstack等 1. 使用 + 字符 ...

  6. bzoj 2648 SJY摆棋子 —— K-D树

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2648 学习资料:https://blog.csdn.net/zhl30041839/arti ...

  7. Poj1218_THE DRUNK JAILER(水题)

    一.Description A certain prison contains a long hall of n cells, each right next to each other. Each ...

  8. orcal数据库得连接必须用localhost,url中不要用127.0.0.1,不然无法连接

    orcal数据库得连接必须用localhost,url中不要用127.0.0.1,不然无法连接,

  9. 问题6:如何让字典保持有序(使用collections的OrderedDict方法)

    from collections imort OrderedDict d = OrderedDict() d['aa'] = (1, 30) d['bb'] = (2, 31) d['cc'] = ( ...

  10. JVM体系结构之六:堆Heap之1

    一.简介 对于大多数应用来说,Java 堆(Java Heap)是Java 虚拟机所管理的内存中最大的一块.Java 堆是被所有线程共享的一块内存区域,在虚拟机启动时创建.此内存区域的唯一目的就是存放 ...