[Interest] Byte Swapping float and double

Michael Jackson imikejackson at gmail.com
Sat Sep 7 18:24:26 CEST 2013


I have some code that needs to convert from the system to Big Endian byte order. All my integers work just fine but I am getting linker errors when trying to byte swap floats and doubles.

I have #include <QtCore/QtEndian>

and I have a templates function like this:

template<typename T>
void foo(T value)
{
  value = qToBigEndian(value);
   .. does something with that data.
}

I am linking against the QtCore library only at the moment and my linker errors are this:

 Undefined symbols for architecture x86_64:
  "double qbswap<double>(double)", referenced from:
      double qToBigEndian<double>(double) in SurfaceMeshToVtk.cpp.o
      double qToBigEndian<double>(double) in SurfaceMeshToNonconformalVtk.cpp.o
  "float qbswap<float>(float)", referenced from:
      float qToBigEndian<float>(float) in NodesTrianglesToVtk.cpp.o
      float qToBigEndian<float>(float) in SurfaceMeshToVtk.cpp.o
      float qToBigEndian<float>(float) in SurfaceMeshToNonconformalVtk.cpp.o
      float qToBigEndian<float>(float) in VtkRectilinearGridWriter.cpp.o
      float qToBigEndian<float>(float) in VisualizeGBCD.cpp.o
      float qToBigEndian<float>(float) in LaplacianSmoothing.cpp.o
      float qToBigEndian<float>(float) in FindNRingNeighbors.cpp.o

What am I missing?

--
Mike Jackson
imikejackson & gmail * com




More information about the Interest mailing list