c++ - Linux userspace header failing to compile with g++ -


i have cpp source file in have included following linux uapi header:

#include <linux/netfilter_ipv4/ip_tables.h>

i'm using rh6, header seems identical 1 found in linux kernel mainline: http://lxr.free-electrons.com/source/include/uapi/linux/netfilter_ipv4/ip_tables.h

the problem upon compiling cpp source file g++, i'm (obviously) receiving following error:

/usr/include/linux/netfilter_ipv4/ip_tables.h:222: error: invalid conversion 'void*' 'xt_entry_target*'

i know can surpass -fpermissive flag, hardly solution.

also, tried surrounding inclusion in extern "c" {} block (which far understand should make compiler see inside c code , allow implicit conversion), error not go away.

how c++ program deal kind of c incompatibilities? (where 1 cannot directly edit source causing trouble)

got working following preprocessing statements:

#if __gnuc__ > 4 || (__gnuc__ == 4 && __gnuc_minor__ > 2) || (__gnuc__ == 4 && __gnuc_minor__ == 2 && __gnuc_patchlevel__ > 3)     #if __gnuc__ > 4 || (__gnuc__ == 4 && __gnuc_minor__ > 6) || (__gnuc__ == 4 && __gnuc_minor__ == 6 && __gnuc_patchlevel__ > 3)          #pragma gcc diagnostic push     #endif      #pragma gcc diagnostic ignored "-fpermissive"      #include <linux/netfilter_ipv4/ip_tables.h>      #if __gnuc__ > 4 || (__gnuc__ == 4 && __gnuc_minor__ > 6) || (__gnuc__ == 4 && __gnuc_minor__ == 6 && __gnuc_patchlevel__ > 3)          #pragma gcc diagnostic pop     #endif #else     #error @ least gcc 4.2.4 required #endif 

used documentation available at: https://gcc.gnu.org/onlinedocs/gcc/diagnostic-pragmas.html#diagnostic-pragmas

it takes consideration diagnostic pragmas introduced in gcc 4.2.4 , support push/pop operations these pragmas introduced in gcc 4.6.4.

currently i'm compiling 4.4.7 pragma takes effect whole translation unit, @ least not force me supply flag when invoking compiler.

thanks @richard critten pointing me right direction.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -