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!
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.