Re: NGPT + C++ = ?
Corey Minyard <[email protected]>
| Newsgroups | gmane.linux.ngpt.devel |
|---|---|
| Message-ID | <[email protected]> |
Can you give a complete code example? That would be quite useful.
-Corey
Harro Verkouter wrote:
>Hi,
>
>We wanted to switch to using NGPT for our MT apps (since the
>non-Posixicity of LinuxThreads is killing us...) so of we went
>installing 2.0.1 (first upgrading our system to 2.4.19, and patching
>it)... so far so good...
>
>We did not install ngpt in the default location but in /usr/local.
>We had to change to makefile since it could not cope with that.
>
>We moved on, trying to compile one of the modules of our project, which
>does not use threads. We told the compiler (g++ 2.95.3) not to look in
>the standard include paths, but rather in the paths we specified. Made
>sure that /usr/local/include was before /usr/include.
>
>So far so good. However, the compiler barfs on the netinet/in.h file
>(through inclusion of bits/in.h) over the following construction:
>
><<< snippet from /usr/include/bits/in.h >>>
>
>/* Structure used to describe IP options for IP_OPTIONS. The `ip_dst'
> field is used for the first-hop gateway when using a source route
> (this gets put into the header proper). */
>struct ip_opts
> {
> struct in_addr ip_dst; /* First hop; zero without source route. */
> char ip_opts[40]; /* Actually variable in size. */
>
> ^^^^^^^^^^^^^^^^^
> this is where the compiler barfs on...
> };
>
><<< /snippet >>>
>
>The output from g++:
>
>[master]:Okay->gmake
>g++ -fPIC -nostdinc -g -Wall -fexceptions -ftemplate-depth-25
>-D_REENTRANT -DBUILDTIME="\"Tuesday 13 August 2002/09:22:09\""
>-D_POSIX_PTHREAD_SEMANTICS
>-I/usr/lib/gcc-lib/i486-suse-linux/2.95.3/include -I/usr/local/include
>-I/usr/include -I/usr/include/g++ -I/jop200_0/verkout/pci/src/libs/ -c
>-o /jop200_0/verkout/pci/src/libs/myutil/Repos/i686/hostname.o
>hostname.cc ;
>In file included from /usr/include/netinet/in.h:250,
> from
>/jop200_0/verkout/pci/src/libs/myutil/hostname.h:28,
> from hostname.cc:21:
>/usr/include/bits/in.h:69: ANSI C++ forbids data member `ip_opts' with
>same name as enclosing class
>gmake: *** [/jop200_0/verkout/pci/src/libs/myutil/Repos/i686/hostname.o]
>Error 1
>[master]:Okay->
>
>
>
>When I cut and paste the struct definition (as in the snippet) into a .c
>file and compile using gcc -> no problemo. If a write it to a .cc file
>and compile with g++, I get exactly the same error about ANSI C++
>forbidding etc.
>
>This would indicate that somehow, the compiler does not recognize the
>ip_opts as a C-style struct...
>
>I've tried with an extern "C" {} declaration around it (in the test
>file) but that made no difference (was to be expected, of course, but
>you could always give it a try).
>
>
>
>Does anyone have an idea what's causing this and/or how to fix it?
>
>
>The system is a dual PIII 1.13GHz running patched (fmutex-<..>-2.0.1
>patch) 2.4.19 SMP kernel.
>
>
>
>
>
>Thanx in advance,
>
>
>
>