现在的位置: 首页 > 综合 > 正文

gcc

2012年07月29日 ⁄ 综合 ⁄ 共 309字 ⁄ 字号 评论关闭

file1.c

 

#include <stdio.h>
void z()
{
printf(
"file1 is used");
return ;
}

 

hello.c

 

#include<stdio.h>
//#include "file1.h"

int main()
{
   printf(
"hello world \n");//ctrl + shift切换输入法
   z();
   
return 0;
}

 

gcc -c file1.c -o fiile1.o

gcc -c hello.c -o hello.o

gcc hello.o file1.o -o hello

./hello

注:这样连接的时候不需要在hello.c文件中加入#include"file1.c"

抱歉!评论已关闭.