码迷,mamicode.com
首页 > 其他好文 > 详细

预处理命令

时间:2017-09-20 10:31:33      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:tin   ...   oid   class   处理   logs   std   color   int()   

/* 1.c*/
#include"1.h"
void print(void)
{
    printf("Testing %d...\n",a);
}
/*1.h*/
#include<stdio.h>
extern int a;
void print(void);
/*test.c*/
#include"1.h"
int a=5;
void main(void)
{
    print();
}

 

 Makefile

test:1.o test.o
    gcc -o test 1.o test.o -lm
1.o:1.c
    gcc -c 1.c -o 1.o -lm
test.o:test.c
    gcc -c test.c -o test.o -lm
.PHONY:clean
clean:
    rm -rf 1.o test.o test

运行结果

Testing 5...

预处理命令

标签:tin   ...   oid   class   处理   logs   std   color   int()   

原文地址:http://www.cnblogs.com/wireless-dragon/p/7559752.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!