磨礪技術珠磯,踐行數據之道,追求卓越價值
回到上一級頁面: 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索引頁