#include<windows.h>
LRESULT CALLBACK window_callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
// Create Window Class
WNDCLASS window_class = {};
window_class.style = CS_HREDRAW | CS_VREDRAW;
window_class.lpszClassName = L"Game Window Class";
window_class.lpfnWndProc = window_callback;
// Register Class
RegisterClass(&window_class);
// Create Window
CreateWindow(window_class.lpszClassName, "My First Game!", WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 1280, 720, 0, 0, hInstance, 0);
}
I'm following Dan Zaidan's tutorial on how to make pong in C++, but it is a year or two out of date, which is probably why I'm receiving these errors:
E0029 expected an expression
C2059 syntax error: ')'
There are a few more lines of code, if necessary I can include them.
Edit 1: added 1 CW_USEDEFAULT. I still receive errors, E0167 and C2664. Edit 2: added more code to hopefully allow you guys to understand better.
Getting E0167 and C2664 means you are trying to use ascii strings but your project settings are set to Unicode. You can see in your code when you define the class name string you use the "L" prefix. Do that everywhere. Change
"My First Game!"toL"My First Game!".