首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

gcc编译多个不同行径下的.c文件

2013-06-26 
gcc编译多个不同路径下的.c文件在home/hcx/gcc下,一个main.c,代码如下#include stdio.h#include test.h

gcc编译多个不同路径下的.c文件
在home/hcx/gcc下,一个main.c,代码如下

#include <stdio.h>
#include "test.h"

int main()
{
print();
return 0;
}
,在home/hcx/gcc/gcctest下,一个test.c
#include <stdio.h>
#include "test.h"

void print()
{
printf("this is print func\n");
}
和一个test.h
#ifndef _TEST_H_
#define _TEST_H_

void print();

#endif
这样gcc要怎么写?也就是不同路径下的.c文件要怎么一起编译 gcc
[解决办法]
gcc -I./gcctest -o main main.c ./gcctest/test.c

热点排行