I’m struggeling to get a QNX-Target (applies to both x86_64 and aarch64) compiled due to conflicting declarations in combination with #include_next statements. It is related to stdlib.h and cstdlib somehow. The QNX-Code reveals a bunch of compiler switches that control the inclusions but I cannot figure out what to set or unset. To get you in the picture here is an extract of the build log:
[ 60%] Building CXX object mcdtestenv/CMakeFiles/mcgateway_app.dir/__/mcgateway/common/xcp_adaptive_service_params.cpp.o
In file included from /home/developer/qnx710/target/qnx7/usr/include/c++/8.3.0/cstdlib:77,
from /home/developer/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_algo.h:59,
from /home/developer/qnx710/target/qnx7/usr/include/c++/8.3.0/algorithm:62,
from /home/developer/vrte/project/mcgateway/mcgateway/common/common_std_inc.hpp:52,
from /home/developer/vrte/project/mcgateway/mcgateway/common/common_inc.hpp:50,
from /home/developer/vrte/project/mcgateway/mcgateway/common/xcp_adaptive_service_params.cpp:48:
/home/developer/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/std_abs.h:56:15: error: 'long int std::abs(long int)' conflicts with a previous declaration
abs(long __i) { return __builtin_labs(__i); }
^
In file included from /home/developer/qnx710/target/qnx7/usr/include/c++/8.3.0/cstdlib:75,
from /home/developer/qnx710/target/qnx7/usr/include/c++/8.3.0/bits/stl_algo.h:59,
from /home/developer/qnx710/target/qnx7/usr/include/c++/8.3.0/algorithm:62,
from /home/developer/vrte/project/mcgateway/mcgateway/common/common_std_inc.hpp:52,
from /home/developer/vrte/project/mcgateway/mcgateway/common/common_inc.hpp:50,
from /home/developer/vrte/project/mcgateway/mcgateway/common/xcp_adaptive_service_params.cpp:48:
/home/developer/qnx710/target/qnx7/usr/include/c++/v1/stdlib.h:111:44: note: previous declaration 'long int abs(long int)'
inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {return labs(__x);}
I investigated on that #include_next feature introduced by GCC. I understand it, I guess but it does not help solving my issue.
Has someone of you guys had this issue, too or similar? I posted this issue into the QNX Foundary27 forum as well, but haven’t got any feedback so far.
Any hint is appreciated! Thanx!
Cheers,
Umberto