H
hobbes_7_8
Hi everybody!
I'm having a very strange behaviour on my pre-processor. Basically I
have the following piece of code:
#if (defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 4)) \
|| defined(_POSIX2_C_VERSION) \
|| (defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200112L))
#include <unistd.h>
#else
extern "C"
{
#include "getopt.h"
}
#endif
.... the goal is to use the system's implementation of the getopt()
function if it is available (that's why those tests are there) or use
the sample implementation that came with Visual Studio 6.0 in the
remaining cases (e.g., on Windows).
On Windows 2000 + Visual Studio .NET 2003, everything works fine.
On HP-UX B.11.11 U + gcc 3.4.2, I get the following error:
In file included from effdoc.cpp:3:
precomp.h:29:20: getopt.h: No such file or directory
*** Error exit code 1
Stop
.... this is very strange as the pre-processor macros tested should make
the contents of the if clause expand, not the else clause:
_XOPEN_VERSION = 4
_POSIX_VERSION = 199309
_POSIX2_C_VERSION = 199209
.... does anyone have an idea of what's going on?
Any help greatly appreciated.
André
I'm having a very strange behaviour on my pre-processor. Basically I
have the following piece of code:
#if (defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 4)) \
|| defined(_POSIX2_C_VERSION) \
|| (defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200112L))
#include <unistd.h>
#else
extern "C"
{
#include "getopt.h"
}
#endif
.... the goal is to use the system's implementation of the getopt()
function if it is available (that's why those tests are there) or use
the sample implementation that came with Visual Studio 6.0 in the
remaining cases (e.g., on Windows).
On Windows 2000 + Visual Studio .NET 2003, everything works fine.
On HP-UX B.11.11 U + gcc 3.4.2, I get the following error:
In file included from effdoc.cpp:3:
precomp.h:29:20: getopt.h: No such file or directory
*** Error exit code 1
Stop
.... this is very strange as the pre-processor macros tested should make
the contents of the if clause expand, not the else clause:
_XOPEN_VERSION = 4
_POSIX_VERSION = 199309
_POSIX2_C_VERSION = 199209
.... does anyone have an idea of what's going on?
Any help greatly appreciated.
André