Handmade Hero»Forums»Code
Tim
13 posts
Struct Creation with Curly Braces doesn't Compile
Hello All,

On Day 017 @ 1:34:00 we switch from:

game_controller_input ZeroController = {};
*NewKeyboardController = ZeroController;

to

*NewKeyboardController = {};

I tried it out and it gives me the following error:

win32_handmade.cpp
w:\handmade\code\win32_handmade.cpp(710) : error C2059: syntax error : '{'
w:\handmade\code\win32_handmade.cpp(710) : error C2143: syntax error : missing ';' before '{'

Could I have set up my compiler incorrectly? I am calling vcvarsall.bat and am using Windows 8.1 and Sublime Text.

Thank you for your help!
Timothy McCarthy
52 posts
Struct Creation with Curly Braces doesn't Compile
This is a C++ 11x change. It's a new initialization syntax...the details elude me at the present. If the compiler doesn't support the new C++ 11x changes you need to revert to the previous statements. IIRC, it was mentioned in the stream during the Q&A and the change accepted as fairly benign.
Tim
13 posts
Struct Creation with Curly Braces doesn't Compile
Thank you! Installing Visual Studio Community (aka VC 14.0) fixed the problem. I am now calling that vcvarsall.bat file.