參考:
首先我們假設在這個目錄下已經有一些**了,例如main.c,我們使用automake來建立makefile,步驟如下。
1)首先在目錄下執行autoscan。
2)修改configure.scan為configure.in。
3)編輯configure.in
# -*- autoconf -*-
# process this file with autoconf to produce a configure script.
ac_prereq(2.61)
# 這下面都是需要填寫的內容,如包的名稱,版本號和bug報告的郵箱
ac_init(full-package-name, version, bug-report-address)
ac_config_srcdir([main.c])
ac_config_header([config.h])
# checks for programs.
ac_prog_cc
# checks for libraries.
# checks for header files.
# checks for typedefs, structures, and compiler characteristics.
# checks for library functions.
ac_output
我們可以看到上面的預設配置,我們修改一下配置,修改後就成了下面這個樣子。
# -*- autoconf -*-
# process this file with autoconf to produce a configure script.
ac_prereq(2.61)
# 新增我們的配置,如包的名稱為helloworld,版本0.1,郵箱等
ac_init(helloworld, 0.1, soundbbg@gmail.com)
ac_config_srcdir([main.c])
ac_config_header([config.h])
# 新增一些基本配置
am_init_automake(main, 1.0)
# checks for programs.
ac_prog_cc
# checks for libraries.
# checks for header files.
# checks for typedefs, structures, and compiler characteristics.
# checks for library functions.
# 在這裡新增輸出makefile
ac_output([makefile])
4)修改完成後退出,執行aclocal。
5)執行完成後執行autoheader
6)完成之後,我們建立乙個makefile.am,並修改如下。
automake_options=foreign
bin_programs=main
main_sources=main.c
7)修改完成後執行automake –a
8) 執行 autoconf
9)執行完成後執行./configure
ok我們的makefile就生成好了,這個時候只要我們make一下就可以編譯程式了。編譯完成後可以執行./***x 來執行自己的程式。
(大致生成流程圖如下:)
圖 2生成makefile流程圖
深談auto變數
1.c 中有乙個關鍵字auto,c語言也有這麼乙個關鍵字,但是兩者的意義大不相同。2.c 中用auto定義的變數自動匹配賦值號右邊的值的型別,具有自動匹配型別的作用,而c語言中auto只是宣告乙個變數為自動型別,說明這個變數的 塊生存期和分配在棧上,並且不能用來定義變數。3.c 中auto可以起到泛...
auto 基本使用
一 用途 auto是c 程式語言的關鍵字。用於兩種情況 1 宣告變數時根據初始化表示式自動推斷該變數的型別 2 宣告函式時函式返回值的佔位符 二 簡要理解 auto可以在宣告變數時根據變數初始值的型別自動為此變數選擇匹配的型別。舉例 對於值x 1 既可以宣告 int x 1 或 long x 1,也...
IE下margin 0 auto不居中解決方法
正常情況下需要將div居中顯示時,使用css樣式 margin 0 auto即可,但有時使用margin 0 auto後在ff chrome裡能居中,而在ie678裡不居中的現象。如下 margin 0 auto 內容居中顯示 可以是對網頁主體宣告文字居中,即body 即 margin 0 auto...