最近刚刚开始玩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. IBM V3500存储恢复步骤实例(linux)

    本环境是一有台IBM3500存储,将存储挂载至linux的/data目录,模拟测试当主服务器挂了,将数据恢复到另一台服务器,存储有两个地址,我配置的是192.168.80.59是用于web管理,192 ...

  2. VC++6.0编译环境介绍

    大家可能一直在用VC开发软件,但是对于这个编译器却未必很了解.原因是多方面的.大多数情况下,我们只停留在"使用"它,而不会想去"了解"它.因为它只是一个工具,我 ...

  3. hdu-5652 India and China Origins(二分+bfs判断连通)

    题目链接: India and China Origins Time Limit: 2000/2000 MS (Java/Others)     Memory Limit: 65536/65536 K ...

  4. Android repo 学习参考

    /*************************************************************************** * Android repo 学习参考 * 说 ...

  5. 趣味Shell

    Richard M. Stallman大神是谁就不用说了,一时来了兴趣,想看看Linux系统下有多少程序有这位大神参与编写的. 先把所有命令导出到文件中,遍历所有命令,用man手册查一下并过滤Stal ...

  6. ffmpeg 翻译文档

    ffmpeg 翻译文档 (参考源文件ffmpeg-all 包含重要组件) 目录: 1 命令语法 2 描概览 3 详细说明 4 流的选择(指定) 5 选项 技提示(原版已废弃) 6 例子 7 语法 8 ...

  7. Skype SILK vs. iLBC vs. Speex

    对比一下这三种VOIP语音算法的特点: 1 参数与特征 2 SILK性能 关于iLBC和Speex的性能可以参考以前写的文章. 3 关于VOIP一些观点(仅代表个人观点) 1)  Skype 辛苦三年 ...

  8. 1115. Counting Nodes in a BST (30)

    A Binary Search Tree (BST) is recursively defined as a binary tree which has the following propertie ...

  9. Javascript:必须知道的Javascript知识点之“单线程事件驱动”

    heiboard: Javascript:必须知道的Javascript知识点之“单线程事件驱动”

  10. OpenStack、CloudStack、Eucalyptus和vCloud Director四大主流云平台怎么选?

    软件产品开发公司Altoros Systems的IT基础设施设计师Vadim Truksha在美国<网络世界>上发表一篇文章,详细对比了CloudStack.Eucalyptus.vClo ...