用VC wizard 建一个console application:#include "stdafx.h"
#include <mmsystem.h>int main(int argc, char* argv[])
{
printf("Hello World!\n");
return 0;
}
如果include mmsystem.h这个系统自带的头文件:
o\vc98\include\mmsystem.h(112) : error C2146: syntax error : missing ';' before identifier 'MMVERSION'
studio\vc98\include\mmsystem.h(112) : fatal error C1004: unexpected end of file found相应的出错位置:
/* general data types */
#ifdef _WIN32
-》typedef UINT        MMVERSION;  /* major (high byte), minor (low byte) */
#else
typedef UINT        VERSION;    /* major (high byte), minor (low byte) */
#endif
typedef UINT        MMRESULT;   /* error return code, 0 means no error */
/* call as if(err=xxxx(...)) Error(err); else */
#define _MMRESULT_网上也有人碰到同样的问题,清高手帮忙,谢谢!

解决方案 »

  1.   

    添加头文件
    #include "stdafx.h"
    #include <wtypes.h>
    #include <mmsystem.h>
      

  2.   


    #include "stdafx.h"
    #include <wtypes.h>  //add for including mmsystem.h
    #include <mmsystem.h> 
    #include <stdio.h> //add for printfint main(int argc, char* argv[])
    {
    printf("Hello World!\n");
    return 0;
    }
    上面代码编译ok,由于没有调用mmsystem.h中声明的函数,所以不需要包含winmm.lib(不是小三说的mmsystem.lib),当程序调用了其中的函数时,需要在link选项中加入winmm.lib,或者在代码中加入:#pragma comment(lib, "winmm.lib")
      

  3.   

    果然通了,谢谢!
    能讲讲原因么?这个wtypes.h和mmsystem.h有啥关系?