1

如何确定哪个 pcap.h 文件包含在通过 Makefile 编译/安装的 C 源代码中?

具体来说,它是一个 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")
4

1 回答 1

0

您可以查看生成的选项Makefile以查看-I传递给的选项gcc吗?您还可以传递给以-H显示gcc它最终使用的头文件:

   -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 ...! .
于 2010-12-14T16:52:16.323 回答