Handmade Hero » Forums » Code » Compiling
plhearn
2 posts
#15312 Compiling
1 month ago Edited by plhearn on May 18, 2018, 3:12 a.m. Reason: Initial post

I've been having trouble compiling the source code after following the instructions and I was wondering if anyone can point me in the right direction to figure out whats wrong. I'm getting compile errors like below when I run build.bat:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
c:\handmade\code>build.bat
'ctime' is not recognized as an internal or external command,
operable program or batch file.
cl : Command line warning D9002 : ignoring unknown option '-Zo'
simple_compressor.cpp
cl : Command line warning D9002 : ignoring unknown option '-Zo'
handmade.cpp
c:\handmade\code\handmade_world_mode.cpp(117) : error C2059: syntax error : '{'
c:\handmade\code\handmade_world_mode.cpp(117) : error C2143: syntax error : missing ';' before '{'
c:\handmade\code\handmade_world_mode.cpp(121) : error C2059: syntax error : '{'
c:\handmade\code\handmade_world_mode.cpp(121) : error C2143: syntax error : missing ';' before '{'
c:\handmade\code\handmade_world_mode.cpp(121) : error C2143: syntax error : missing ';' before '}'
c:\handmade\code\handmade_world_mode.cpp(121) : warning C4552: '+' : operator has no effect; expected operator with side-effect
Generating Code...
Compiling...
handmade_msvc.c
Generating Code...
cl : Command line warning D9002 : ignoring unknown option '-Zo'
win32_handmade.cpp
c:\handmade\code\handmade_opengl.cpp(791) : error C2001: newline in constant
c:\handmade\code\handmade_opengl.cpp(791) : error C2065: 'R' : undeclared identifier
c:\handmade\code\handmade_opengl.cpp(791) : error C2143: syntax error : missing ';' before 'string'
c:\handmade\code\handmade_opengl.cpp(791) : error C2059: syntax error : 'string'
c:\handmade\code\handmade_opengl.cpp(812) : error C2143: syntax error : missing ';' before '{'
c:\handmade\code\handmade_opengl.cpp(812) : error C2447: '{' : missing function header (old-style formal list?)


...plus a lot more.

I think the reason this might be happening is that when I run vcvarsall.bat x64 I'm running it from my visual studio 2010 folder. I downloaded visual studio 2013 express and tried to use the vcvarsall.bat in there but it won't let me run it with the x64 parameter because it says it doesn't have the toolset. Upon searching further it turns out the express version of visual studio 2013 doesn't come with the 64-bit toolset. So I'm not sure where to go from here. Do I need to buy the retail version of visual studio 2013? Is it even available anymore? Is there a better solution someone else knows about? It seems like most people here are able to compile the source so I feel like I'm missing something.
mmozeiko
Mārtiņš Možeiko
1693 posts
1 project
#15313 Compiling
1 month ago Edited by Mārtiņš Možeiko on May 18, 2018, 3:54 a.m.

Yes, the error are because VS2010 does not support few C++11 features Casey is using in code.

All versions of Visual Studio Express does not come with 64-bit target compiler. They can produce only 32-bit code. It is possible to get 64-bit code compiling, but that requires a lot of hacking and configuring...

Just download Visual Studio 2013 Community edition (NOT Express). You don't need Professional / retail version. Community Edition is what Casey is using. It is free. Get it here: https://www.visualstudio.com/vs/older-downloads/

Eventually Casey upgrades Visual Studio to 2017 Community Edition. You can use VS2017 also for earlier days, but it will require few tweaks and fixes to source code.
plhearn
2 posts
#15320 Compiling
1 month ago Edited by plhearn on May 18, 2018, 5:12 a.m.

Thank you so much! I got the community version and now its working just fine with the 2013 64-bit compiler. For anyone else having trouble with this you should know the link to the visual studio community downloads no longer works. It takes you to a page that says there are no downloads. To get community 2013 I had to find a link to the installer in a youtube video of all places. Here is the link:

https://go.microsoft.com/fwlink/?LinkId=517284

It might be a good idea to update the readme to the direct link on the microsoft site since it looks like its the only way to get the compiler tools now.