baiyunjn 发表于 2016-11-22 01:37:17

Makefile 的 遗漏分隔符错误信息

  磨砺技术珠矶,践行数据之道,追求卓越价值
  回到上一级页面: PostgreSQL杂记页   回到顶级页面:PostgreSQL索引页
  
  我在学Makefile的写法时候,参考了如下的链接:
http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
  hellomake.c
---------------------------------
#include <hellomake.h>
  int main() {
   // call a function in another file
myPrintHelloMake();
return(0);
}
-----------------------------------
  hellofunc.c
-----------------------------------
  #include <stdio.h>
void myPrintHelloMake(void) {
printf("Hello makefiles!\n");
return;
}
------------------------------------
  hellomake.h
------------------------------------
/*
example include file
*/
  void myPrintHelloMake(void);
-------------------------------------
  写Makefile如下:
  hellomake: hellomake.c hellofunc.c
    gcc -o hellomake hellomake.c hellofunc.c -I.
  执行make命令时,却报如下错误:
Makefile ...2 ... 遗漏分隔符...停止
  经过调查,发现是这样的:
  Makefile的 hellomake: 行被称为rule。
第二行,是具体的编译动作。开头不可以有空格,留白是由 按tab键形成的。
  去掉空格,改为tab键后,再执行make命令,成功。
  
  磨砺技术珠矶,践行数据之道,追求卓越价值
  回到上一级页面: PostgreSQL杂记页   回到顶级页面:PostgreSQL索引页
页: [1]
查看完整版本: Makefile 的 遗漏分隔符错误信息