LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 785|回复: 3

小弟菜鸟 请大鸟们给我找错误

[复制链接]
发表于 2009-12-30 07:41:27 | 显示全部楼层 |阅读模式
makefile
main: main.o mytool1.o mytool2.o
gcc - o main main.o mytool1.o mytool2.o
main.o: main.c mytool1.h mytool2.h
gcc - c main.c
mytool1.o: mytool1.c mytool1.h
gcc - c mytool1.c
mytool2.o:mytool2.c mytool2, h
gcc -c mytool2.c
            main.c
    #include"mytool1.h"
#include"mytool2.h"
int
main (int argc, char **argv)
{
  mytools1_print ("hello");
  mytools2_print ("hello");
  return 0;
}
      
      /*mytool1.c*/
#include  "mytool1.h"
void
mytool1_print (char *print_str)
{
  printf ("this is mytool1 print %s\n", print_str);
}
    /*mytool1.h*/
#ifndef_MYTOOL_1_H
#define_MYTOOL_1_H
void mytool1_print(char *print_str);


#endif


/*mytool2.c*/
#include  "mytool2.h"
void
mytool2_print (char *print_str)
{
  printf ("this is mytool2 print %s\n", print_str);
}
   
/*mytool2.h*/
#ifndef_MYTOOL_2_H
#define_MYTOOL_2_H
void mytool2_print(char *print_str);


#endif

makefile:2: *** 遗漏分隔符 。 停止。
 楼主| 发表于 2009-12-30 07:50:41 | 显示全部楼层
查了知道了,用tab啊,其实在看书的时候也还记得 。但是还是有一个问题 ,到底在什么地方前面加tab,那些不用加???这是一个简单的问题吧!!希望大牛们给我一个简单有效的回答!
回复 支持 反对

使用道具 举报

发表于 2009-12-30 14:11:46 | 显示全部楼层
好好系统地学一下GNU make吧!GNU make manual中讲得比较具体。
你需要了解makefile中的一些术语。比如

  1. target ... : dependencies ...
  2.         command
复制代码

GNU make规定,所有的command行都必须以tab开头。
回复 支持 反对

使用道具 举报

发表于 2010-1-4 21:37:01 | 显示全部楼层
要多来学习学习
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表