博客
关于我
linux下编译C语言常用命令(未完待续)
阅读量:591 次
发布时间:2019-03-09

本文共 830 字,大约阅读时间需要 2 分钟。

linux下编译C语言常用命令(未完待续)

1. 文件管理相关的命令

Linux命令 作用 举例
mkdir 新建文件夹 mkdir test、mkdir -p /test/test1
cd 进入工作目录 cd test
ls 列出当前文件夹下的文件 ls、ls -R、ls -a
pwd 查看当前所在目录 pwd
cp 将A复制到B cp A B、cp A …/B
rm 删除文件或文件夹 rm test.c、rm test -r
mv 移动文件 mv test.c …/test1
cat 查看文件内容 cat test.c、cat test.c -n
touch 创建文件或更新文件时间 touch test.c、touch test.c test.c

2. vim编辑器

  • 编辑模式

    模式 描述
    命令行模式 启用vi的初始模式
    编辑模式 按下i进入,同时左下角出现INSERT字样;按ESC退出
    末行模式 保存文本,退出编辑器等操作
  • 末行模式操作命令

    命令 描述
    :w 保存内容
    :q! 强制退出
    :q 退出未修改的文件
    :x 保存并退出(等效:wq)
    :set nu 显示行号

3. GCC编译C程序

对于C:gcc [options][filenames]

对于C++:g++ [options][filenames]

参数 作用
-o 指定输出可执行程序名称
-c 标记编译支持库代码
-lm 查看系统提供的数学库(libm)
-Wall 开启GCC最常用的警告
编译指令 描述
gcc test.c -o test 编译单个源文件test.c,指定输出可执行程序名称为test
gcc test.c test1.c 编译多个源文件为可执行文件
gcc test.c -c -lm 只对test.c进行编译和汇编,但不进行连接,在转换过程要求GCC查看数学库
gcc test.o test1.o -o test 将目标代码合并为可执行程序test

转载地址:http://xhppz.baihongyu.com/

你可能感兴趣的文章
Nmap哪些想不到的姿势
查看>>
Nmap扫描教程之Nmap基础知识
查看>>
nmap指纹识别要点以及又快又准之方法
查看>>
Nmap渗透测试指南之指纹识别与探测、伺机而动
查看>>
Nmap端口扫描工具Windows安装和命令大全(非常详细)零基础入门到精通,收藏这篇就够了
查看>>
NMAP网络扫描工具的安装与使用
查看>>
NMF(非负矩阵分解)
查看>>
nmon_x86_64_centos7工具如何使用
查看>>
NN&DL4.1 Deep L-layer neural network简介
查看>>
NN&DL4.3 Getting your matrix dimensions right
查看>>
NN&DL4.7 Parameters vs Hyperparameters
查看>>
NN&DL4.8 What does this have to do with the brain?
查看>>
nnU-Net 终极指南
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
NO 157 去掉禅道访问地址中的zentao
查看>>
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>