zoukankan      html  css  js  c++  java
  • 关于makefile的编写

    这两天学了Makefile,下面记录一些有关与自己的学习笔记.
    make 命令执行时,需要一个 Makefile 文件,以告诉 make 命令需要怎么样的去编译和链接程序.
    #####一.基本语法
    1.首先,我们看下makefile书写规则:

    target : preprequisites 
    command(注意,此行一定是开头tab键然后才开始写命令)
    

    2.makefile当中#代表注释 

    3.最后一行可写 

    clean: 
    rm -f *o 
    #清除以构建的目标文件

    二.实例:
    首先我的程序是创建一个People类,然后再创建 Student类和Teacher类共有继承People类,在Student类中创建一个私有属性Teacher类的对象teacher,最后在main函数里创建Student类的对象student.
    函数编译过程是先编译people.cpp,然后创建student时会先创建t eacher对象,因此要先编译teacher.cpp再编译student.cpp,最后再编译
    main.cpp,大致过程就是如此,
    makefile代码如下:

    main:main.cpp student.o people.o teacher.o
        g++ main.cpp student.o people.o teacher.o -o main
    student.o:student.h people.o
        g++ student.cpp -c -o student.o
    teacher.o:teacher.h people.o
        g++ teacher.cpp -c -o teacher.o
    people.o:people.h
        g++ people.cpp -c -o people.o
    clean:
        rm -f *o
    

      

     
  • 相关阅读:
    ORA-14404
    ORA-00845
    ORA-00054
    oracle-11g-配置dataguard
    ORACLE 11G 配置DG 报ORA-10458、ORA-01152、ORA-01110
    Python:if __name__ == '__main__'
    HDFS-Shell 文件操作
    HDFS 概述
    PL/SQL Developer
    CentOS7 图形化方式安装 Oracle 18c 单实例
  • 原文地址:https://www.cnblogs.com/topk/p/6580125.html
Copyright © 2011-2022 走看看