歡迎您光臨本站 註冊首頁

linux下查找變數與常量的頭文件方法

←手機掃碼閱讀     火星人 @ 2014-03-26 , reply:0

今天看別人寫的程序,遇到函數,常量找不到頭文件的錯誤,在windows中好解決,在linux下看書看到了,所以摘下來供以後察看

摘自:Beginning.Linux.Programming,Third.Edition

It』s often convenient to use the grep command to search header files for particular definitions and function
prototypes. Suppose we need to know the name of the #defines used for returning the exit status
from a program. Simply change to the /usr/include directory and grep for a probable part of the
name like this:
$ grep EXIT_ *.h
...
stdlib.h:#define EXIT_FAILURE 1 /* Failing exit status. */
stdlib.h:#define EXIT_SUCCESS 0 /* Successful exit status. */
...
$
Here grep searches all the files in the directory with a name ending in .h for the string EXIT_. In this
example, it has found (among others) the definition we need in the file stdlib.h.

[火星人 ] linux下查找變數與常量的頭文件方法已經有272次圍觀

http://coctec.com/docs/linux/show-post-188220.html