Ask Your Question
0

When will I need to define HAVE_IFADDRS_H?

asked 2012-01-01 05:37:28 -0500

Ricky gravatar image Ricky flag of Taiwan, Province of China
716 21 30 40
http://homepage.ntu.edu.t...

Hi! I am figuring out the mechanism in the roscpp package, and I found there's codes in the function determineHost() in network.cpp:

#ifdef HAVE_IFADDRS_H

...

#endif

There's a comment : fall back on interface search, which will yield an IP address

But I don't know what does it mean~

Can someone give me a brief explanation?

Thanks in advance, Ricky.

edit retag flag offensive close delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-01-01 18:01:22 -0500

ahendrix gravatar image ahendrix
3127 15 28 65
http://namniart.com/

The HAVE_IFADDRS_H symbol is defined by the ros build system if your system has the ifaddrs.h header; you should never have to define it yourself.

It looks like that particular chunk of code is trying to find an outward-facing IP address to use to identify the computer it's running on.

If you want more information about it, I suggest reading the man page for getifaddrs.

edit flag offensive delete publish link more

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

subscribe to rss feed

Stats

Asked: 2012-01-01 05:37:28 -0500

Seen: 104 times

Last updated: Jan 01 '12