linking error, undefined symbol

Feb 6, 2013 at 12:47pm
Hi!!
i'm writing a source code for extending Snort IDS. What i have is a source and a header file. In my source file, at some point i want to use a function that snort has already implemented. The function is defined in a source file sf_ip.c and declared in the header file sf_ip.h.

So i thought that if i #include "sf_ip.h", i could use that function! During compilation i get no errors (uses gcc) but when i start Snort i get the following :
ERROR: Failed to load /home/alex/Desktop/snort-2.9.4/src/dynamic-preprocessors/build/usr/local/lib/snort_dynamicpreprocessor/libdpx.so: /home/alex/Desktop/snort-2.9.4/src/dynamic-preprocessors/build/usr/local/lib/snort_dynamicpreprocessor/libdpx.so: undefined symbol: sfip_to_str

I've searched everywhere but didn't manage to find a solution!
Thanks!
Last edited on Feb 7, 2013 at 10:04am
Feb 7, 2013 at 2:36pm
if you have only the h and c files, then you need to include those h and c files to your projects. You need to add only the header file when you have a lib/dll that you link to your project.
So just add both those files to your project and it should be ok, unless they have other dependencies.
Feb 7, 2013 at 2:59pm
needed a change in the Makefile, added the .c file to the sources and then it was able to create the library...
thanks for your time anyway!
Last edited on Feb 7, 2013 at 3:00pm
Feb 9, 2013 at 9:32am
tryuterrrgtry675
Topic archived. No new replies allowed.