Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Compiling Qt with Struct Member Alignment of one (/Zp1)
DinosHaveNoLife last edited by
I have a Qt project which uses a few other libraries made by the company i work for. A struct member alignment of one is used for every library and project in our system. I don't know the details but it is something hardware related.
I managed to compile qtmain, QtCore and QtGui (the only ones i use) with a Struct Member Alignment of one. But when I build and run my project (which also has the /Zp1 flag) it runs into an assert in qmutex.h -> 'QMutex pointer is misaligned'. After some searching I found that QMutex can only be used with a Struct Member Alignment of 2 or 4. I tried to solve this issue with:
#pragma pack(push, 2)
// the QMutex class
Still the assert is false.
Version: Qt 4.8.4.
IDE: Visual Studio 2005.
Am I approaching this wrong or is changing the struct member alignment blasphemy?