Re: Can't link C++ program to libipset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 2015-03-18 12:20, Pavel Odintsov wrote:
>
>I trying to integrate ipset to my flood monitoring toolkit
>https://github.com/FastVPSEestiOu/fastnetmon but can't link it
>correctly.
>
>Here you can find [the snippet of] my code:
>https://gist.github.com/pavel-odintsov/b2277822e5c88e136550
>
>And tried link my tool with libipset but haven't any success:
>g++ ipset.c  -I/opt/ipset/include/ -L/opt/ipset/lib -lipset
>ipset.c: In function ‘int main()’:
>ipset.c:15:37: warning: deprecated conversion from string constant to
>‘char*’ [-Wwrite-strings]

This is a bug in your code, not ipset. In C++, string literals
have type const char *. In C, they have type char * but are still
immutable, so you better treat them as const char * in both cases.

>/tmp/ccWP0vdf.o:ipset.c:function ban_ip(char*, char*): error:
>undefined reference to 'ipset_session_init(int (*)(char const*, ...))'

It's an ipset bug. The ipset header files are missing

#ifdef __cplusplus
extern "C" {
#endif
...
wraps.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux