gpt4 book ai didi

c - Ruby/C/Makefile,-lpcap/#include 中使用的默认 pcap.h 文件是什么

转载 作者:太空宇宙 更新时间:2023-11-04 04:57:30 26 4
gpt4 key购买 nike

如何确定通过 Makefile 编译/安装的 C 源代码中包含的 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")

最佳答案

您能否查看生成的 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 ...! .

关于c - Ruby/C/Makefile,-lpcap/#include <pcap.h> 中使用的默认 pcap.h 文件是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4310958/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com