libc functions from c++ issues

Chris Johns chrisj at rtems.org
Thu Apr 14 02:14:07 UTC 2022


On 14/4/2022 6:58 am, Joel Sherrill wrote:
> When you use -std= with gcc, it says to strictly enforce that standard. C++ is
> NOT POSIX so pthread.h prototypes aren't visible.  There are some edge cases
> where gcc isn't that strict until -pedantic is turned on. Use of long long in
> C++03 is an example of that. 
> 
> -D_POSIX_C_SOURCE=200809 is precisely the answer I think but -D_GNU_SOURCE
> enables almost everything I think.
> 
> Anyway, here's a small Makefile with some comments to help:

Nice and thanks. I reviewed the flags on this page:

https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html

And adding `_XOPEN_SOURCE` to the compiler command line allowed the code to
build. I will raise the strict vs non-strict issue with the project. I suspect
they are not aware there is an issue.

Chris


More information about the devel mailing list