相关讨论
大家好,我是个高中生,高中1年纪。
最近在学习linux下的编程。
// 文件main.c
#include
#include "hello.h"
int main()
{
str_printf("hello");
return 0;
}
// hello.h
#ifndef HELLO_H_
#define HELLO_H_
void str_printf(const char *str);
#endif
// hello.c
#include "hello.h"
void str_printf(const char *str)
{
printf("hello.c:%s\n", str);
}
请问makefile文件该怎么写?
test.h
#ifndef _TEST_H_
#define _TEST_H_
void print();
#endif
test.c
#include
#include "test.h"
void print()
{
printf("hello,world\n");
}
main.c
#include "test.h"
int main()
{
print();
return 0;
}
makefile:
mycpp: main.o test.o
gcc -o mycpp main.o test.o
main.o: main.c test.h
gcc -c main.c
test.o: test.c
gcc -c test.c
makefile...
by
hr_it
-
C/C++
-
2008-09-17 00:10:10 阅读(2690) 回复(11)
这是我写的一个makefile
VPATH=../lib:../include:../bin
lib = ../lib/
bin = ../bin/
objects=bank.o adminlogin.o mainmenu.o execute.o deposit.o withdraw.o query.o \
write.o read.o listall.o cancelaccount.o establishaccount.o
bank : $(objects)
gcc $(objects) -o $(bin)bank
bank.o : bank.c includeofbank.h includeofstruct.h
gcc -c bank.c -o $(lib)bank.o
mainmenu.o : mainmen...
本人明天就要交程序
但是突然发现要求要makefile
但我对这个根本不太了解
我有5个目录,as.tgs.client.kdc 和sever_v
每个目录下基本都有main.cpp和tea.hpp等文件
请问如何构造makefile?
应该是在主目录下构造一个makefile,然后在5个目录下分别构造5个makefile,
但是该怎么写了?
更大的问题是,我的程序是在LINUX下编译通过
但是放到SUN的UNIX下编译无法通过
如果是在Solaris上编译,因该把相应的头文件包含进去,如:“sys /...
下了个java1.4源代码包,怎样执行make,我的操作系统是SCO UNIX
by
zxllxz
-
Java
-
2005-09-04 15:19:38 阅读(477) 回复(0)
为什么要加上-I . -g -Wall -ansi呀?
用gcc -c main.c 不就好了吗?
:em14:
freemem:freemem.c
cc freemem.c -o freemem
下面这个命令不懂,哪位高手拔刀相助:
gcc -I . -g -Wall -ansi -c main.c
红色部分请指教!
:roll:
下面这个命令不懂,哪位高手拔刀相助:
gcc -I . -g -Wall -ansi -c main.c
红色部分请指教!
:em06:
下面这个命令不懂,哪位高手拔刀相助:
gcc -I . -g -Wall -ansi -c main.c
红色部分请指教! :em14: