Skip to contentSkip to conversation

Link problems with libxtables

DISCUSSION Michael Lawson (mshindo) 2 participants 3 messages May 22, 2009 – May 25, 2009 1 message not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

I am having problems using a member function of libxtables:

g++ main.cpp Firewall.cpp Rule.cpp Match.cpp IP4Addr.cpp -lxtables -liptc /tmp/cce5IKHM.o: In function `print_match(xt_entry_match const*, ipt_ip const*, int)':
Firewall.cpp:(.text+0x326): undefined reference to `xtables_find_match(char const*, xtables_tryload, xtables_rule_match**)'
collect2: ld returned 1 exit status
make: *** [all] Error 1

I understand this is most likely a link problem, can someone point me in the right direction ?

--
Michael Lawson

#2 lore raw
Quoted 11 lines · Michael Lawson (mshindo)

I am having problems using a member function of libxtables:

g++ main.cpp Firewall.cpp Rule.cpp Match.cpp IP4Addr.cpp -lxtables -liptc /tmp/cce5IKHM.o: In function `print_match(xt_entry_match const*, ipt_ip const*, int)':
Firewall.cpp:(.text+0x326): undefined reference to `xtables_find_match(char const*, xtables_tryload, xtables_rule_match**)'
collect2: ld returned 1 exit status
make: *** [all] Error 1

Quoted 2 lines

I understand this is most likely a link problem, can someone point me in the right direction ?

We need this

parent a869eab48f6cf27ffc9b7ed5b2303ff2bd3e943c (v1.4.3.2-4-ga869eab) commit ab63b538b69379236f9cc1be9040e342eef433fb

Author: Jan Engelhardt <[email protected]>
Date:   Fri May 22 11:46:55 2009 +0200

xtables: use extern "C"

---
 include/xtables.h.in |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
include/xtables.h.in +8 -0
index a399f90..4d4ca0a 100644
@@ -203,6 +203,10 @@ struct xtables_globals
 	void (*exit_err)(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3)));
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern const char *xtables_modprobe_program;
 extern struct xtables_match *xtables_matches;
 extern struct xtables_target *xtables_targets;
@@ -295,4 +299,8 @@ extern void _init(void);
 
 #endif
 
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
 #endif /* _XTABLES_H */
Signature · 1 line
# Created with git-export-patch
#3 lore raw

cc kaber, to apply

Quoted 12 lines · Jan Engelhardt
Quoted 12 lines

I am having problems using a member function of libxtables:

g++ main.cpp Firewall.cpp Rule.cpp Match.cpp IP4Addr.cpp -lxtables -liptc /tmp/cce5IKHM.o: In function `print_match(xt_entry_match const*, ipt_ip const*, int)':
Firewall.cpp:(.text+0x326): undefined reference to `xtables_find_match(char const*, xtables_tryload, xtables_rule_match**)'
collect2: ld returned 1 exit status
make: *** [all] Error 1

Quoted 5 lines
Quoted 2 lines

I understand this is most likely a link problem, can someone point me in the right direction ?

We need this

parent a869eab48f6cf27ffc9b7ed5b2303ff2bd3e943c (v1.4.3.2-4-ga869eab) commit ab63b538b69379236f9cc1be9040e342eef433fb

Author: Jan Engelhardt <[email protected]>
Date:   Fri May 22 11:46:55 2009 +0200

xtables: use extern "C"

---
 include/xtables.h.in |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
include/xtables.h.in +8 -0
index a399f90..4d4ca0a 100644
@@ -203,6 +203,10 @@ struct xtables_globals
 	void (*exit_err)(enum xtables_exittype status, const char *msg, ...) __attribute__((noreturn, format(printf,2,3)));
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern const char *xtables_modprobe_program;
 extern struct xtables_match *xtables_matches;
 extern struct xtables_target *xtables_targets;
@@ -295,4 +299,8 @@ extern void _init(void);
 
 #endif
 
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
 #endif /* _XTABLES_H */
Signature · 1 line
# Created with git-export-patch