Quantcast
Channel: User vesperto - Stack Overflow
Viewing all articles
Browse latest Browse all 44

Answer by vesperto for CRTSCTS not define when compiling as C99

$
0
0

You can use -D_DEFAULT_SOURCE -std=c99 instead of -std=gnu99, at least in gentoo. It "seems more standard" to me.

Searching around in /usr/include, I see:

/usr/include/features.h 52    _DEFAULT_SOURCE  The default set of features (taking precedence over 53       __STRICT_ANSI__). 61    The `-ansi' switch to the GNU C compiler, and standards conformance 62    options such as `-std=c99', define __STRICT_ANSI__.  If none of 63    these are defined, or if _DEFAULT_SOURCE is defined, the default is 64    to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to 65    200809L, as well as enabling miscellaneous functions from BSD and 66    SVID.  If more than one of these are defined, they accumulate.  For 67    example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together 68    give you ISO C, 1003.1, and 1003.2, but nothing else.383 #if defined _DEFAULT_SOURCE384 # define __USE_MISC 1385 #endif

Other files, such as in /usr/include/boost/* and /usr/include/eigen3/* also make use of _DEFAULT_SOURCE.

Also, the link provided by @CamW in a comment is quite enlightening:

   *  The macros that you most likely need to use in modern source      code are _POSIX_C_SOURCE (for definitions from various      versions of POSIX.1), _XOPEN_SOURCE (for definitions from      various versions of SUS), _GNU_SOURCE (for GNU and/or Linux      specific stuff), and _DEFAULT_SOURCE (to get definitions that      would normally be provided by default).   _DEFAULT_SOURCE (since glibc 2.19)          This macro can be defined to ensure that the "default"          definitions are provided even when the defaults would          otherwise be disabled, as happens when individual macros          are explicitly defined, or the compiler is invoked in one          of its "standard" modes (e.g., cc -std=c99).  Defining          _DEFAULT_SOURCE without defining other individual macros          or invoking the compiler in one of its "standard" modes          has no effect.          The "default" definitions comprise those required by          POSIX.1-2008 and ISO C99, as well as various definitions          originally derived from BSD and System V.  On glibc 2.19          and earlier, these defaults were approximately equivalent          to explicitly defining the following:              cc -D_BSD_SOURCE -D_SVID_SOURCE          -D_POSIX_C_SOURCE=200809

Viewing all articles
Browse latest Browse all 44

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>