2010-11-30 31 views
1

如何確定正在編譯/安裝的C源代碼中包含哪個pcap.h文件一個Makefile?Ruby/C/Makefile,在-lpcap /#中使用的默認pcap.h文件包括:<pcap.h>

具體來說,它是正在通過安裝Ruby庫(pcaprub):

ruby extconf.rb && make && make install 

和extconf.rb是:

require 'mkmf' 

if /i386-mswin32/ =~ RUBY_PLATFORM 
    pcap_dir  = with_config("pcap-dir", "C:\WpdPack") 
    pcap_includedir = with_config("pcap-includedir", pcap_dir + "\\include") 
    pcap_libdir  = with_config("pcap-libdir", pcap_dir + "\\lib") 

    $CFLAGS = "-DWIN32 -I#{pcap_includedir}" 
    $LDFLAGS = "/link /LIBPATH:#{pcap_libdir}" 
    have_library("wpcap", "pcap_open_live") 
    have_library("wpcap", "pcap_setnonblock") 
else 
    have_library("pcap", "pcap_open_live") 
    have_library("pcap", "pcap_setnonblock") 
end 

if (RUBY_VERSION =~ /^1\.9/) 
    $CFLAGS += " -DRUBY_19" 
end 

create_makefile("pcaprub") 

回答

0

你可以看一下生成的Makefile看什麼-I選項正在傳遞給gcc?您也可以通過-Hgcc顯示頭文件,它結束了使用:

-H Print the name of each header file used, in addition to other 
     normal activities. Each name is indented to show how deep in the 
     #include stack it is. Precompiled header files are also printed, 
     even if they are found to be invalid; an invalid precompiled header 
     file is printed with ...x and a valid one with ...! . 
相關問題