[vbox-dev] Including net.h in string.h breaks things

Oliver Loch grimeton at gmx.net
Thu Aug 23 13:00:32 GMT 2012


I'm adding IPV6 support to VBox right now, and get a weird error message while compiling VBox:

In file included from /home/builder/vbox42/22082012/virtualbox/src/VirtualBox-4.2/include/iprt/string.h:34:0,
                 from /home/builder/vbox42/22082012/virtualbox/src/VirtualBox-4.2/src/VBox/Additions/x11/vboxvideo/vboxvideo.h:111,
                 from /home/builder/vbox42/22082012/virtualbox/src/VirtualBox-4.2/src/VBox/Additions/x11/vboxvideo/setmode.c:55:
/home/builder/vbox42/22082012/virtualbox/src/VirtualBox-4.2/include/iprt/net.h:97:19: error: expected identifier or '(' before numeric constant
kmk: *** [/home/builder/vbox42/22082012/virtualbox/src/VirtualBox-4.2/out/linux.amd64/release/obj/vboxvideo_drv_70/setmode.o] Error 1

What did I do?

I added some headers to "include/iprt/string.h" and the functions to "src/VBox/Runtime/common/string/RTStrIp6.cpp". I also added the function to "include/iprt/mangling.h"
To make kBuild recognize "RTStrIp6.cpp", "Makefile.kmk" in "src/VBox/Runtime" is patched.

Everything seems to work fine, until the following function:

"RTDECL(int) RTStrToIpAddress6(const char *psz, PRTNETADDRIPV6 pAddr, uint32_t *pPortOut, char *pszScopeOut, size_t scopeOutSize);"

has been declared. The function uses PRTNETADDRIPV6 to return the binary representation of an IPv6 address. So to make this structure visible during compile time, I included "iprt/net.h" at the top of "string.h".

After doing that, I always end up with the above error message. I checked all files mentioned above multiple times, ran cpp only to check the returned source - nothing.

If the include statement is removed and the function is commented out, everything builds just fine.

"net.h" is fine, too - the mentioned line in net.h is the point of definition of the INETADDR union. https://www.virtualbox.org/browser/vbox/trunk/include/iprt/net.h#L97

So, I'm a bit lost now. Someone any suggestions what I could try?



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4343 bytes
Desc: not available
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20120823/becc2b27/attachment.p7s>

More information about the vbox-dev mailing list