我正在使用一个名为snort的开源项目,该项目是在Linux下用C语言编写的。我已经正确地在netbeans中打开了这个项目,现在我要对这个源代码进行一些更改。程序的src文件夹包含了几个文件夹,每个文件夹又有一些文件夹。我听说netbeans能够生成make文件。我正在对XFolder文件夹中的src文件进行一些更改,并想在我的项目中的另一个文件夹(YFolder)中使用一个库函数。我已经包含了.h文件并正确地使用了这个函数。
#include"../YFolder/lib.h"
现在我能编译程序,一切正常,但是当我使用在make过程中创建的动态库“.so(共享对象文件)”并运行程序时,我看到一个错误,意味着我从其他文件夹使用的函数未定义,并且看到以下错误(sfxhash_new是我调用的外部函数的名称)。
我还编辑了Makefile.am,并添加了该包的源代码(../YFolder/lib.c和lib.h)。但没有效果。有人能帮我吗?libsf_sip_preproc.so: undefined symbol: sfxhash_new
编辑: 我在src/dynamic-preprocessor/sip文件夹中 我想在文件src/sfutil/sfxHash.c中使用一个函数 该函数名为sfxhash_new(... ... ...) 我正确地包含了sfxHash.h。 我对我的Makefile.am进行了一些更改,但主要的Makefile是这个。
我的Makefile.am文件:
## $Id
AUTOMAKE_OPTIONS=foreign no-dependencies
INCLUDES = -I../include -I${srcdir}/../libs -I$(srcdir)/includes
libdir = ${exec_prefix}/lib/snort_dynamicpreprocessor
lib_LTLIBRARIES = libsf_sip_preproc.la
libsf_sip_preproc_la_LDFLAGS = -shared -export-dynamic -module @XCCFLAGS@
if SO_WITH_STATIC_LIB
libsf_sip_preproc_la_LIBADD = ../libsf_dynamic_preproc.la
else
nodist_libsf_sip_preproc_la_SOURCES = \
../include/sf_dynamic_preproc_lib.c \
../include/sf_ip.c \
endif
libsf_sip_preproc_la_SOURCES = \
spp_sip.c \
spp_sip.h \
sip_config.c \
sip_config.h \
sip_parser.c \
sip_parser.h \
sip_dialog.c \
sip_dialog.h \
sip_roptions.c \
sip_roptions.h \
sip_utils.c \
sip_utils.h \
sip_debug.h \
../include/sfxhash.c \ -----------------> I have copied src files in this dictionary
../include/sfxhash.h ------------------>
EXTRA_DIST = \
sf_sip.dsp
all-local: $(LTLIBRARIES)
$(MAKE) DESTDIR=`pwd`/../build install-libLTLIBRARIES