Václav Zindulka <vaclav.zindulka@xxxxxxxxxx> wrote: > I have problem with compilation (linking) of my program using > libnftables.h and libnftables library. I always get undefined > reference no mater how I adjust the command. My app is written in C++ > and I want to use libnftables since I will make a lot of dynamic > changes in nftable rules (tc categorization of packets). I have > created simple prototype of app to learn usage of libnftables. I'm > using git version of nftables since it supports conversion from c++ > string using .c_str() function, which can't be done in 0.9.0 yet. I > also use latest versions of libnftnl and libmnl. I'm running it on > Debian Stretch using stock 4.9 and even compiled 4.19 from backport > sources since I need to apply some patches for production application. [..] > /tmp/ccgLgVWC.o: In function `main': > main.cpp:10: undefined reference to `nft_ctx_new(unsigned int)' You need to request C-Linkage. try extern "C" { #include <nftables/libnftables.h> }