apue 在 mac 环境编译错误
参考资料:https://unix.stackexchange.com/questions/105483/compiling-code-from-apue
笔者使用 mac 学习 apue, 在编译的时候出现错误,错误如下:
Undefined symbols for architecture x86_64:
"_TELL_CHILD", referenced from:
_main in 14_5-4244a7.o
"_TELL_PARENT", referenced from:
_main in 14_5-4244a7.o
"_TELL_WAIT", referenced from:
_main in 14_5-4244a7.o
"_WAIT_CHILD", referenced from:
_main in 14_5-4244a7.o
"_WAIT_PARENT", referenced from:
_main in 14_5-4244a7.o
"_err_sys", referenced from:
_lock_test in 14_5-4244a7.o
_main in 14_5-4244a7.o
_lockabyte in 14_5-4244a7.o
"_lock_reg", referenced from:
_lockabyte in 14_5-4244a7.o
ld: symbol(s) not found for architecture x86_64
在解决该问题时浪费很多时间,记下解决办法,希望可以帮助到你。
前提:已经正确安装 apue,安装方法自行搜索,路径如下:
DilldeMacBook-Pro:apue.3e dill$ pwd
/Users/dill/Downloads/apue.3e
DilldeMacBook-Pro:apue.3e dill$ cp include/* /usr/local/include/
DilldeMacBook-Pro:apue.3e dill$ cp lib/* /usr/local/lib/
避免上文的编译错误,采用如下命令编译:
gcc -o myls myls.c -I /usr/local/include -L /usr/local/lib/ -lapue
myls.c 为需要编译的 C 文件
-I 为 gcc 指定 include 地址
-L 为 gcc 指定 library 地址
-lapue 指定在 lib 文件夹中 library 文件名("/usr/local/lib/libapue.a")
-LXXX means to look for a file in the library directory with the name: libXXX.a or libXXX.so.
apue 在 mac 环境编译错误的更多相关文章
- lamp环境编译错误
GD 编译出错解决方法 编译最新的2.0.35版本,用默认的 ./configure编译 当make的时候,出现以下错误 configure.ac:64: error: possibly undefi ...
- mac gcc 编译错误 基础问题
mac gcc Undefined symbols for architecture x86_64 "std::__1: // Undefined symbols for architec ...
- 编译错误“The run destination My Mac 64-bit is not valid for Running the scheme '***',解决办法
1. iOS APP Project or Mac APP Project编译错误提示: “The run destination My Mac 64-bit is not valid for Ru ...
- 编译错误“The run destination My Mac is not valid for Running the scheme '***',解决办法
[转载] http://blog.csdn.net/duanyipeng/article/details/8007684 编译错误"The run destination My Ma ...
- Android编译环境——ubuntu12.04上android2.3.4编译错误以及解决
Android编译环境——ubuntu12.04上android2.3.4编译错误以及解决 分类: android应用开发2013-08-21 09:20 4222人阅读 评论(3) 收藏 举报 li ...
- mac 环境下Android 反编译源码
mac环境下Android 反编译 一.需要的工具 apktool:反编译APK文件,得到classes.dex文件,同时也能获取到资源文件以及布局文件. dex2jar:将反编译后的classes. ...
- Xamarin Studio在Mac环境下的配置和Xamarin.iOS常用控件的示例
看过好多帖子都是Win环境装XS,Mac只是个模拟器,讲解在Mac环境下如何配置Xamarin Studio很少,也是一点点找资料,东拼西凑才把Xamarin Studio装在Mac上跑起来,如下: ...
- (五) 一起学 Unix 环境高级编程 (APUE) 之 进程环境
. . . . . 目录 (一) 一起学 Unix 环境高级编程 (APUE) 之 标准IO (二) 一起学 Unix 环境高级编程 (APUE) 之 文件 IO (三) 一起学 Unix 环境高级编 ...
- 尝试在Mac上编译DNX
自从XRE改名为DNX至今,从来没有在Mac OS X上成功编译过DNX.一直很纳闷,难道DNX的开发人员不用Mac?今天突然明白了,DNX的开发人员真的不用Mac.而且DNX用的2个持续集成服务Ap ...
随机推荐
- 02/Oct/2019:11:55:28 类型的时间转换为
public static String upDataTime(String time) { Date upTime = new Date(); String newtime = null; Simp ...
- SpringBoot之持久化框架
在之前的 Spring学习之旅(十二)--持久化框架 中我们介绍了 JPA 的使用,今天我们就来了解下另一种持久化框架 Mybatis. 一.集成 Mybatis 1.1 准备工作 新建用户表 CRE ...
- 遗传算法的C语言实现(二)
上一次我们使用遗传算法求解了一个较为复杂的多元非线性函数的极值问题,也基本了解了遗传算法的实现基本步骤.这一次,我再以经典的TSP问题为例,更加深入地说明遗传算法中选择.交叉.变异等核心步骤的实现.而 ...
- hive中groupby和distinct区别以及性能比较
Hive去重统计 先说核心: 都会在map阶段count,但reduce阶段,distinct只有一个, group by 可以有多个进行并行聚合,所以group by会快. 经常在公司还能看到.很多 ...
- Codeforces Round #569 (Div. 2) C. Valeriy and Deque
链接: https://codeforces.com/contest/1180/problem/C 题意: Recently, on the course of algorithms and data ...
- Vue路由参数设置可有可无
参数后面使用 ? id 后面加个 ‘ ? ’ ,将 id 设置为可选参数 { name: "index", path: '/p/:id?', component: resolve ...
- Apache Flink CEP 实战
本文根据Apache Flink 实战&进阶篇系列直播课程整理而成,由哈啰出行大数据实时平台资深开发刘博分享.通过一些简单的实际例子,从概念原理,到如何使用,再到功能的扩展,希望能够给打算使用 ...
- C# 向上取整数
PageCount = personInfodb.get_count(selected_id); //数据总数 PageCount = (int)Math.Ceiling(PageCount / (P ...
- jquery empty选择器 语法
jquery empty选择器 语法 作用::empty 选择器选取空的元素.空元素指的是不包含子元素或文本的元素.直线电机滑台 语法:$(":empty") jquery emp ...
- html body标签 语法
html body标签 语法 标签body是什么意思? 标签body是一个网页的身体部分,也就是用于定义网页的主体内容,也是一个HTML文档中必须的部分. 作用:定义文档的主体. 广州大理石机械构件 ...