Reputation: 157
I've a C++ application that works in actual compilers (I compile it with eclipse). Now, I need compile it on a very old compiler version (gcc/c++ v2.96) on a Redhat 7.3 with Kdevelop.
When I compile the app it gives the following error: swprintf undeclared. wchar.h header it's included, but I saw this file in the RH7.3 OS and only declare this function if __USE_UNIX98 __USE_ISOC99 are declared.
How can I enable __USE_UNIX98?
Upvotes: 4
Views: 1539
Reputation: 171253
From inspection of <features.h>
defining _XOPEN_SOURCE
to 500 or greater will cause __USE_UNIX98
to be defined
Upvotes: 2
Reputation:
GNU libc defines the features that should be enabled in all of its headers using a special system header <features.h>
. If you define the appropriate macros, <features.h>
will define __USE_UNIX98
for you.
The typical way to get all functions, regardless of what standard (if any) covers them, is by adding -D_GNU_SOURCE
on the command-line. Getting only the functions covered by a specific standard requires defining the macro as specified in that standard using the value specified in that standard, such as -D_POSIX_C_SOURCE=200112L
. The precise values that are supported on your particular implementation are probably easiest found by inspecting /usr/include/features.h
manually.
Upvotes: 3