最近刚刚开始玩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. The Quantum L3 router and floating IPs

    This post shows how the Quantum L3 Agent uses the Linux IP stack to implement the Quantum L3 Routing ...

  2. 如何设置minSdkVersion和targetSdkVersion

    转http://www.07net01.com/2015/07/878098.html minSdkversion和targetSdkVersion相信很多人都不太理解,我在网上也看了许多关于这两者区 ...

  3. 分享知识-快乐自己:遍历Map集合

    import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class TestMap { pu ...

  4. 分享知识-快乐自己:mongodb 安装部署(linux)

    1):下载 mongodb 包 [root@admin tools]# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6. ...

  5. vc6++Release和Debug

    1. 如何快速地规范代码缩进格式 选中所需要规范的代码,按shift+F8 2. 如何在Release状态下进行调试 Project->Setting=>ProjectSetting对话框 ...

  6. Android基于socket的群聊程序

    在网上看了好多,但是感觉不是太简单就是只能单独聊,所以就自己写了个可以群聊的,直接上代码了 一.服务器端 这里用的MyEclipse作为服务器端 MyServerScoket.java package ...

  7. POJ1041 John's trip

    John's trip Language:Default John's trip Time Limit: 1000MS Memory Limit: 65536K Total Submissions: ...

  8. PRVF-0002 : could not retrieve local node name

    安装 oracle 的时候,./runInstaller 启动报错  PRVF-0002 : could not retrieve local node name 碰到这个错误是因为 OUT试图对你主 ...

  9. maven的配置文件取不同版本

    1. 两个地方需要配置首先是要定义配置源,dev/test/prod对应的配置源需要指定:这是灵活的,可变的:其次要定义配置文件,该配置文件里面的内容采用占位符的方式来编制,在编译打包的过程中要动态根 ...

  10. virtual judge(专题一 简单搜索 E)

    Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose ...