netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Can't link C++ program to libipset
@ 2015-03-18 11:20 Pavel Odintsov
  2015-03-18 11:39 ` Pavel Odintsov
  2015-03-18 12:01 ` Jan Engelhardt
  0 siblings, 2 replies; 6+ messages in thread
From: Pavel Odintsov @ 2015-03-18 11:20 UTC (permalink / raw)
  To: netfilter-devel

Hello, folks!

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 my code:
https://gist.github.com/pavel-odintsov/b2277822e5c88e136550

I installed recent version from Git:
cd /usr/src
git clone git://git.netfilter.org/ipset.git
apt-get install -y automake libtool
./autogen.sh
./configure --prefix=/opt/ipset
make install

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]
ipset.c:15:37: warning: deprecated conversion from string constant to
‘char*’ [-Wwrite-strings]
/tmp/ccWP0vdf.o:ipset.c:function ban_ip(char*, char*): error:
undefined reference to 'ipset_session_init(int (*)(char const*, ...))'
/tmp/ccWP0vdf.o:ipset.c:function ban_ip(char*, char*): error:
undefined reference to 'ipset_parse_setname(ipset_session*, ipset_opt,
char const*)'
/tmp/ccWP0vdf.o:ipset.c:function ban_ip(char*, char*): error:
undefined reference to 'ipset_type_get(ipset_session*, ipset_cmd)'
/tmp/ccWP0vdf.o:ipset.c:function ban_ip(char*, char*): error:
undefined reference to 'ipset_session_error(ipset_session const*)'
/tmp/ccWP0vdf.o:ipset.c:function ban_ip(char*, char*): error:
undefined reference to 'ipset_parse_elem(ipset_session*, bool, char
const*)'
/tmp/ccWP0vdf.o:ipset.c:function ban_ip(char*, char*): error:
undefined reference to 'ipset_session_error(ipset_session const*)'
/tmp/ccWP0vdf.o:ipset.c:function ban_ip(char*, char*): error:
undefined reference to 'ipset_cmd(ipset_session*, ipset_cmd, unsigned
int)'
/tmp/ccWP0vdf.o:ipset.c:function ban_ip(char*, char*): error:
undefined reference to 'ipset_session_fini(ipset_session*)'
collect2: error: ld returned 1 exit status

But if i change g++ to gcc everything passed with flying colors:
gcc ipset.c  -I/opt/ipset/include/ -L/opt/ipset/lib -lipset

My toolkit written in C++ and I need ability to link it directly with libipset.

Thank you for attention to my problem!

-- 
Sincerely yours, Pavel Odintsov
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-18 20:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-18 11:20 Can't link C++ program to libipset Pavel Odintsov
2015-03-18 11:39 ` Pavel Odintsov
2015-03-18 12:01 ` Jan Engelhardt
2015-03-18 13:15   ` Pavel Odintsov
2015-03-18 20:03     ` Jozsef Kadlecsik
2015-03-18 20:07       ` Pavel Odintsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).