当前位置:网站首页>UNIX环境高级编程(APUE,第三版)---环境搭建
UNIX环境高级编程(APUE,第三版)---环境搭建
2022-06-13 11:50:00 【Venda Liu】
1.下载源码
APUE源码下载地址:http://www.apuebook.com/code3e.html
下载得到src.3e.tar.gz压缩包,解压后的得到apue.3e文件。利用远程连接工具Mobaxterm上传到Centos服务器上,如图所示。
2.进入apue.3e的lib目录下
cd apue.3e/
cd lib/
make # 执行make后生成静态库libapue.a
3.接下来将静态库libapue.a复制到/usr/lib中
查看/usr/lib是否有libapue.a:
cd /usr/lib
ll | grep libapue.a
4.将头文件apue.h复制到/usr/include中
sudo cp libapue.a /usr/include
# 查看文件
cd /usr/lib
ll | grep apue.h
5.在apue.3a目录下查找error.c文件,复制error.c文件,并重命名为myerror.h。将myerror.h文件复制到/usr/include目录下
cd /usr/include
ll | grep myerror.h
# -rw-r--r--. 1 root root 2411 5月 27 22:06 myerror.h
注:如果不复制error.c文件,将会出现err_sys等函数未定义情况。出现这个问题解决方案也可参考:http://blog.chinaunix.net/uid-29179071-id-4117644.html
6.至此,环境准备好了,编写test.c文件,用make命令编译,如图所示。
7.运行书中代码
以第三章hole.c文件,创建一个具有空洞文件为例。
cd apue.3e/fileio
cp hole.c ../../myapue/
cd ../../myapue/
直接make编译文件,出现如下错误:
在hole.c引入头文件myerror.h,保存后再编译,如图所示:
边栏推荐
- [tcaplusdb knowledge base] Introduction to tcaplusdb tcaplusadmin tool
- TS advanced condition type
- Fuel scheme and product business modeling
- TS進階之條件類型
- 基于STM32F103——DS1302日期时间+串口打印
- 89C51 single chip microcomputer driving LCD based on dream
- 14. Notes on using border decorator of WPF
- 7.5.4:Spire Office for .NET New Version
- To avoid letting the transformation enterprises go astray, it is time to re understand the integration of xiahu warehouse| Q recommendation
- web开发者,web开发后台开发
猜你喜欢
[ROS] moveit rviz seven DOF Manipulator Simulation
基于STM32F103——AS608指纹模块+串口打印
1051. 高度检查器
Wallys/Network_Card/DR-NAS26/AR9223/2x2 MIMO
1051. height checker
[tcapulusdb knowledge base] Introduction to tmonitor stand-alone installation guidelines (I)
Lvgl Library Tutorial 01- porting to STM32 (touch screen)
17 pictures: read and understand the first domestic guide for mainframe security capacity building
LVGL库入门教程01-移植到STM32(触摸屏)
(一)爬取Best Sellers的所有分类信息:爬取流程
随机推荐
[tcapulusdb knowledge base] Introduction to new models of tcapulusdb
手动加密 ESP 设备量产固件并烧录的流程
Web development video tutorial, web development teaching
7.5.4:Spire Office for . NET New Version
数据库连接数设置多少合适?
fastapi 如何响应文件下载
(一)爬取Best Sellers的所有分类信息:爬取流程
It's the first time that the programmer interview pays so much attention to the concept of investigation
Will it be a great opportunity for entrepreneurs for Tiktok to attach so much importance to live broadcast sales of takeout packages?
2022.2:EyeshotPro EyeshotUltimate EyeshotFem
【TcaplusDB知识库】TcaplusDB-tcaplusadmin工具介绍
14、wpf之Border装饰器使用小记
Text error correction -- crisp model
docker Dockerfile安装mysql5.7
Socket programming (medium)
[benefits] in minutes
【TcaplusDB知识库】TcaplusDB-tcapsvrmgr工具介绍(一)
C#/VB. Net to generate directory bookmarks when word is converted to PDF
LVGL库入门教程01-移植到STM32(触摸屏)
Miidock file distribution