Giter VIP home page Giter VIP logo

unixenvcode's Introduction

本仓库是《Unix环境高级编程》第3版的单例子运行版本

使用编译器

CLion

CMakeLists.txt 范例

cmake_minimum_required(VERSION 3.15)
project(UnixEnvCode1 C)
include_directories("{pathto}/github/apue.3e/include")
link_libraries("{pathto}/github/apue.3e/lib/libapue.a")
set(CMAKE_C_STANDARD 99)

add_executable(UnixEnvCode1 ${pathOfYouCodeFile})

${} 里面的内容替换成自己的路径或者文件。 需要先下载随书的源码,编译之后引入libapue.a 库。不然在CLion无法编译通过。

使用gcc编译办法

设置环境变量

export UNIX_ENV_CODE="{your source code path}"/apue.3e
# C
export C_INCLUDE_PATH=$UNIX_ENV_CODE/include:$C_INCLUDE_PATH
# CPP
export CPLUS_INCLUDE_PATH=$UNIX_ENV_CODE/include:$CPLUS_INCLUDE_PATH

# 动态链接库搜索路径:
export LD_LIBRARY_PATH=$UNIX_ENV_CODE/lib:$LD_LIBRARY_PATH
# 静态链接库搜索路径:
export LIBRARY_PATH=$UNIX_ENV_CODE/lib:$LIBRARY_PATH

编译步骤

centos 安装gcc,libbsd

wget http://elrepo.reloumirrors.net/testing/el6/x86_64/RPMS/libbsd-0.4.2-1.el6.elrepo.x86_64.rpm
wget http://elrepo.reloumirrors.net/testing/el6/x86_64/RPMS/libbsd-devel-0.4.2-1.el6.elrepo.x86_64.rpm
rpm -ivh libbsd-0.4.2-1.el6.elrepo.x86_64.rpm
rpm -ivh libbsd-devel-0.4.2-1.el6.elrepo.x86_64.rpm

安装后执行make all

gcc test.c -lapue

unixenvcode's People

Contributors

cainiaodj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.