Including header files in C and compile

I work with open source code called snort , which is written in C under Linux. I opened the project correctly in netbeans, and now I will make some changes to this source code. The src folder of the program contains several folders, and also each folder has several folders. I heard that netbeans is able to create make files. I am making some changes to the src files in the XFolder folder and want to use the library function in another folder in my project (YFolder). I included the .h file and used the function correctly.

#include"../YFolder/lib.h"

Now, when I can compile the program, this is fine, but when I use the dynamic libraries “.so (shared object files)” created in the make process; and run the program, I see an error, which means that the function that I used from another folder is not defined and sees this error; (sfxhash_new is the name of the external function that I called).

libsf_sip_preproc.so: undefined symbol: sfxhash_new

I also edited Makefile.am and added the sources of this package ( ../YFolder/lib.c and lib.h); But ineffective. Can anybody help me?

EDIT:

I am in the src / dynamic-preprocessor / sip folder. I want to use the function in the file: src / sfutil / sfxHash.c the name of the function is sfxhash_new (.........) I turned on sfxHash.h correctly. I made some changes. In my Makefile.am, but the main makefile.

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
+5
2

Makefile.am (.. configure make, ). / Makefile.in. automake ( configure.in configure.ac ). , Makefile.am , , libsf_sip_preproc_la_SOURCES - Makefile.am, Makefile.in. configure make.
, , .. sfxhash , Makefile.am, , , INCLUDES, , , / libsf_sip_preproc_la_LIBADD. .la .a libsf_sip_preproc_la_LIBADD.
, !

+2

:

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

SO_WITH_STATIC_LIB , , :

libsf_sip_preproc_la_LIBADD = ../libsf_dynamic_preproc.la

libsf_sip_preproc_la_LIBADD = ../libsf_dynamic_preproc.a

, .

+1

All Articles