VerifyVersionInfo関数でOSのバージョン情報を調べたいのですがコンパイルエラーが出てできません
環境:
windows 7
mingw(gcc)
ソース:
#include <windows.h>
#include <stdio.h>
int main()
{
OSVERSIONINFOEX OSver;
ULONGLONG condition = 0;
OSver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
OSver.dwMajorVersion = 6;
OSver.dwMinorVersion = 1;
VER_SET_CONDITION( condition, VER_MAJORVERSION, VER_EQUAL);
VER_SET_CONDITION( condition, VER_MINORVERSION, VER_EQUAL);
if( VerifyVersionInfo( &OSver, VER_MAJORVERSION | VER_MINORVERSION, condition) )
{
printf("ok");
}
return 0;
}
エラーメッセージ:
ver2.cpp: In function 'int main()':
ver2.cpp:12:31: error: 'VER_MAJORVERSION' was not declared in this scope
VER_SET_CONDITION( condition, VER_MAJORVERSION, VER_EQUAL);
^
ver2.cpp:12:49: error: 'VER_EQUAL' was not declared in this scope
VER_SET_CONDITION( condition, VER_MAJORVERSION, VER_EQUAL);
^
ver2.cpp:12:58: error: 'VER_SET_CONDITION' was not declared in this scope
VER_SET_CONDITION( condition, VER_MAJORVERSION, VER_EQUAL);
^
ver2.cpp:13:31: error: 'VER_MINORVERSION' was not declared in this scope
VER_SET_CONDITION( condition, VER_MINORVERSION, VER_EQUAL);
^
マイクロソフトのverifyversioninfo関数のページを見ると、英語版の方にkernel32.libが必要と書いてあったので、kernel32.libをダウンロードして-lkernel32オプションを付けても同じエラーが出ます。
どうすればいいと思いますか?