I am working with an open source project called snort , which is written in C, under Linux. I opened project in netbeans correctly and now I am going to do some changes in this source code. The src folder of program contains several folders and also each folder has some folders. I heard that netbeans is able to generate make files. I am doing some changes in src files in folder XFolder and want to use a library function in another folder in my project (YFolder). I included .h file and used the function correctly.
#include"../YFolder/lib.h"
Now when I can compile the program, It is Ok, but when I use dynamic libraries ".so (shared object files)" that created in make process; and run program, I see an error that means the function I used from other folder not defined and see this error; (sfxhash_new is the name of external function that I called).
libsf_sip_preproc.so: undefined symbol: sfxhash_new
I also edited Makefile.am and added the sources of that package (../YFolder/lib.c and lib.h
); But not effective. Can anyone help me please?
EDIT:
I am in folder src/dynamic-preprocessor/sip I want to use a function in file: src/sfutil/sfxHash.c the function name is sfxhash_new(... ... ...) I included sfxHash.h correctly. I did some changes In my Makefile.am but the main makefile is this.
My Makefile.am file:
## $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