在xcode中设置include和lib路径
最近刚刚开始玩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路径的更多相关文章
- XCode中设置字体大小
XCode中设置字体大小 1)打开Preferences,快捷键是“Command + ,”(注意,是三个键,按住command键,然后再快速地按“+”和“,”两个键即可) 2)选择“Fonts &a ...
- 如何找出Xcode中不同版本Swift的路径
我们知道Xcode中可能包含不知一个Swift的版本,那么我们如何找到它们对应的路径呢? 熟悉unix shell命令的童鞋都知道有一个find指令,在我们已知Xcode路径时,我们可以在其中找到Sw ...
- (转)Xcode 中设置部分文件ARC支持
ARC是什么 ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting).简单地说,就是代码中自动加入了retain/release,原先需要手动添加的 ...
- Xcode 中设置部分文件ARC支持
ARC是什么 ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting).简单地说,就是代码中自动加入了retain/release,原先需要手动添加的 ...
- gdal库中设置prj4库全路径的用法
作者:朱金灿 来源:http://blog.csdn.net/clever101 gdal库实现投影转换之类的功能实际上底层都是调用prj4库的功能.如果gdal使用非静态的方式集成prj4库,实际上 ...
- ios开发xcode中设置代码块
在开发中有很多重复的代码,很多开发者把常用的代码做成代码块提高开发效率. 在xcode里选中代码块的时候总是很不容易,点击选中的代码(文字),不要移动和松开鼠标左键,当竖线变成像拉长了的x(我也不知道 ...
- 删除xcode中的描述文件的路径
打开Finder commend + shift +g 进入文件夹 : ~/Library/MobileDevice/Provisioning Profiles 删除即可
- Xcode中设置按钮在十分钟之内禁用
btn.enabled=NO;` NSTimer * notificationTimer = [NSTimer scheduledTimerWithTimeInterval:10*60.0 targe ...
- Xcode 常用设置
1.main 文件注释 1)main 文件注释修改路径 /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Proje ...
随机推荐
- jquery侧边折叠导航栏制作,两行代码搞定
jquery侧边折叠导航栏制作,两行代码搞定 //CSS*{margin: 0;padding: 0} ul{list-style: none} .menu li ul{display: none} ...
- POJ 2728 Desert King:最优比率生成树
题目链接:http://poj.org/problem?id=2728 题意: 给你n个点(x,y,z),让你求一棵生成树,使得 k = ∑ |z[i]-z[j]| / ∑ dis(i,j)最小. | ...
- Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined in class path resource [applicationContext.xml]
Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined ...
- fastjson转对象的一些属性设置
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"> < ...
- php 代码中的箭头“ ->”与“=>”是什么意思?
类是一个复杂数据类型,这个类型的数据主要有属性.方法两种东西. 属性其实是一些变量,可以存放数据,存放的数据可以是整数.字符串,也可以是数组,甚至是类. 方法实际上是一些函数,用来完成某些功能. 引用 ...
- nodejs stream基础知识
分类 nodejs 的 stream 有四种: Readable:可读流 Writable: 可写流 Duplex:双工流 Transform:转换流 Readable // _read方法是从底层系 ...
- HDU1370Biorhythms(中国剩余定理||暴力)
Some people believe that there are three cycles in a person's life that start the day he or she is b ...
- Java中的String数据类型
本文主要是说明一些String数据类型的基本知识,有些杂乱,不过都是比较重要的东西,主要是参考了网上人的资料.原文网址:http://dev.yesky.com/91/2309091.shtml 主要 ...
- SQL Server BCP 资料导入导出
SQL Server BCP 导入导出使用 Bcp 导出导入数据高效,比使用SQL Server Management Stdio 提供的数据库导出导入要高效因为sql server 也没有提供提供类 ...
- SQL中top使用方法
转自:https://www.cnblogs.com/wang7/archive/2012/07/09/2582891.html 1. 在编写程序中,我们可能遇到诸如查询最热门的5篇文章或返回满足条件 ...