PDA

View Full Version : #include <mmsystem.h> and DWORD ?



nthung
28th May 2010, 11:37
this is my code

#include <QtCore/QCoreApplication>
#include <mmsystem.h>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
DWORD what;
return a.exec();
}

but it gives me an error"DWORD is not a type name" why is wrong?
thanks

Zlatomir
28th May 2010, 11:44
DWORD is defined in windows.h so #include <windows.h> should do the trick

high_flyer
28th May 2010, 13:37
but bare in mind that using DWORD will make your code non portable!
Better use either 'unsigned long' or better yet, Qt types, such as quint32 etc.

Zlatomir
28th May 2010, 13:46
@high_flyer: Correct, but maybe he has some already written code with DWORD.

But if only DWORD is "missing" you can get away without include windows.h, just typedef DWORD like this:

typedef unsigned long DWORD;