最近刚刚开始玩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. Spring Boot -- actuator

    Spring Boot有四大神器,分别是auto-configuration.starters.cli.actuator,本文主要讲actuator.actuator是spring boot提供的对应 ...

  2. hibernate的update、merge和saveOrUpdate的区别(转)

    1.首先 saveOrUpdate返回void 也就是什么都不返回 而merge会返回一个对象 2.其次 saveOrUpdate的做法是:自动判断该对象是否曾经持久化过,如果曾持久化过则使用upda ...

  3. MySQL丨删除一张表小常识

    在MySQL里面 ,对于删除一张表里面的所有内容有两种语句: 1.delete from table_name; 2.truncate table table_name; 解析:以上两种方式都可以删除 ...

  4. 利用perlin noise 生成 wood texture

    %%% Perlin Noise %%% Wood_texture clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image P ...

  5. Debian for ARM install python 3.5.x

    /********************************************************************************** * Debian for ARM ...

  6. C语言小程序(八)、统计字母个数

    这么简单的程序本不应贴在这里,但每写一篇博客,积分涨10分,距离摆脱千里之外的排名又进一步,相当于刷榜了,哈哈! #include <stdio.h> #include <strin ...

  7. JEECG datagrid 列表检索条件 添加下拉级联功能

    $("#communityId").change( function(){ var id = $(this).children('option:selected').val(); ...

  8. [转]CSS3盒模型display:box详解

    时间:2014-02-25来源:网络作者:未知编辑:RGB display:box;box-flex是css3新添加的盒子模型属性,它的出现可以解决我们通过N多结构.css实现的布局方式.经典的一个布 ...

  9. Python:extend和append的用法

    转于:https://www.cnblogs.com/subic/p/6553187.html 博主:subic 1)list.append(object) 向列表中添加一个对象object2)lis ...

  10. C++ 替换字符串内某个字符或子串

    1. 问题描述 string s="abc"; string tmp="1"; 2.解决方案 // tmp 必须为字符串 // 第一个 1 表示 s 中的位置 ...