The following include on a Qt project is conflicting with my user defined classes:
#ifdef Q_OS_WIN
#include "qt_windows.h"
#include "qwindowdefs_win.h"
#include <shellapi.h>
#endif
Code Snippet:
if (Desktop::MessageBox::question(this, tr("I am ready?"),
tr("I am not ready yet!?")) == QDialog::Rejected )
{
TRACE("Dialog rejected. I am not ready yet.");
return;
}
Errors:
\Desktop\Gui\MainScreen.cpp:953: error: ‘Desktop::MessageBoxA’ has not been declared
My Desktop::MessageBox is conflicting with windows defined MessageBoxA. What is the standard solution for this problem in c++?
#undef MessageBox(and other conflicting names), orRename your class, or
Encapsulate your usage of the Windows API into separate .cpp files so that you don’t need to include the Windows headers everywhere, thus (largely) avoiding the problem.