I just figured out some incompatibilities between my tested platforms using std::copysign.
At a first test I try in MSVC to get some algorithms tested. Now I tried to port this c++(11) code to the Xilinx Zynq platform (A9+FPGA).
This is working so far except there is no std::copysign including cmath. So I have to use copysign without the namespace.
What would be the proper way of adding this function to the namespace?
PS: I do not want to manage the same files on different platforms by hand just for namespace incompatibilities.
Compile flag is:
-c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -std=c++11
You could create a macro for msvc.
#if defined(_MSC_VER)
#define copysign std::copysign
#endif
However, c++11 should have the std namespace. If you aren't compiling with c++11 enabled you might be getting a older set of libraries maybe? I'd check to make sure that you are. If you can't compile with c++11 on your platform then the above should work. Add more preprocessor flags to target more platforms if needed.
Another option is
using namespace std;
which would cover both cases.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.