I am trying to make a window in C++ and I included the windows.h but I get an error that 'windows' has not been declared.
I was following the Creating a Window tutorial on the Microsoft Docs, yet I can't seem to get it to work because of this error.
Here is my code so far:
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
int main()
{
// Register the window class
const wchar_t CLASS_NAME[] = L"Sample Window Class";
windows::WNDCLASS wc = { 0 };
wc.lpfnWndProc = windows::DefWindowProc;
wc.hInstance = windows::GetModuleHandle(NULL);
wc.lpszClassName = CLASS_NAME;
windows::RegisterClass(&wc);
const windows::DWORD window_style = windows::WS_OVERLAPPEDWINDOW;
const windows::DWORD window_ex_style = windows::WS_EX_APPWINDOW;
const windows::RECT window_rect = { 0, 0, 640, 480 };
windows::AdjustWindowRectEx(&window_rect, window_style, FALSE, window_ex_style);
windows::HWND window_handle = windows::CreateWindowEx(
window_ex_style,
CLASS_NAME,
L"Sample Window",
window_style,
windows::CW_USEDEFAULT,
windows::CW_USEDEFAULT,
window_rect.right - window_rect.left,
window_rect.bottom - window_rect.top,
NULL,
NULL,
windows::GetModuleHandle(NULL),
NULL
);
windows::ShowWindow(window_handle, windows::SW_SHOWDEFAULT);
windows::UpdateWindow(window_handle);
return 0;
}
What am I doing wrong?