나는 리눅스에서 C로 작성된 snort이라는 오픈 소스 프로젝트로 작업하고 있습니다. netbeans에서 프로젝트를 올바르게 열었으므로 이제이 소스 코드에서 몇 가지 변경을 수행 할 것입니다. 프로그램의 src 폴더에는 몇 개의 폴더가 있고 각 폴더에는 몇 개의 폴더가 있습니다. netbeans가 파일을 생성 할 수 있다고 들었습니다. XFolder 폴더에서 src 파일의 일부 변경을 수행하고 있으며 내 프로젝트 (YFolder)의 다른 폴더에서 라이브러리 함수를 사용하려고합니다. 나는 .h 파일을 포함하고 함수를 올바르게 사용했다. 나는이 프로그램을 컴파일 할 때은 C로 헤더 파일을 포함하고 컴파일합니다.
#include"../YFolder/lib.h"
지금, 그것은 좋아하지만, 내가 동적 라이브러리 ".so를 (공유 객체 파일)"을 사용할 때 그 메이크업 과정에서 생성; 프로그램을 실행하면 정의되지 않은 다른 폴더에서 사용한 기능을 의미하는 오류가 표시되며이 오류가 표시됩니다. (sfxhash_new는 제가 호출 한 외부 함수의 이름입니다).
libsf_sip_preproc.so : 정의되지 않은 기호 : sfxhash_new는
또한 Makefile.am 편집 및 그 패키지 (../YFolder/lib.c and lib.h
)의 소스를 첨가; 그러나 효과적이지는 않습니다. 누구든지 제발 도와 주실 래요?
편집 :
내가 파일의 기능을 사용하려면 폴더 SRC/동적 전처리/SIP 에서 오전 : SRC/sfutil/sfxHash.c 함수 이름 (sfxhash_new입니다 ... .. . ...) sfxHash.h가 올바르게 포함되었습니다. Makefile.am에서 몇 가지 변경을했는데 메인 메이크 파일은 이것입니다.
내 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 @[email protected]
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
'-lnet -lpcre'등의 플래그를 LDFLAGS의 맨 끝에 넣어야합니까? –
이것은 도움이 될 수도 있습니다 [여기] (http://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s) – ervinbosenbacher
참고 사항 '정의되지 않은 심볼'오류는 헤더 파일 포함의 정확성 또는 부정확성과 아무 관련이 없습니다. 그들은 링커 오류이고 일부 라이브러리가 누락되었음을 보여줍니다. –