Week 4 Day 17: Build file problems

Hey so I've been following along quite closely with casey and I'm on week 4 day 017. I'm having trouble with the build file tho. All we did was change the compiler and linker flags to be variables instead of inline, but when I do that it throws up a bunch of errors it didn't have before the change.

Here's the code that's causing it:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
@echo off

set CommonCompilerFlags = -MT -nologo -Gm- -GR- -EHa- -Od -Oi -WX -W4 -wd4201 -wd4100 -wd4189 -wd4456 -DNEWGAME_INTERNAL=1 -DNEWGAME_SLOW=1 -DNEWGAME_WIN32=1 -FC -Z7 -Fmwin32_newGame.map
set CommonLinkerFlags = -opt:ref user32.lib gdi32.lib

IF NOT EXIST w:\newGame\build mkdir w:\newGame\build
pushd w:\newGame\build
REM cl %CommonCompilerFlags% c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp /link -subsystem:windows,5.1 %CommonLinkerFlags%  REM 32 bit version
cl %CommonCompilerFlags% c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp /link %CommonLinkerFlags%  REM 64 bit version
popd


Here's the output errors:

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(68): error C2065: 'debug_read_output_result': undeclared identifier
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(68): error C2146: syntax error: missing ';' before identifier 'File'
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(68): error C2065: 'File': undeclared identifier
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(68): error C3861: 'DEBUGPlatformReadEntireFile': identifier not found
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(69): error C2065: 'File': undeclared identifier
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(69): error C2228: left of '.Contents' must have class/struct/union
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(69): note: type is 'unknown-type'
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(71): error C2065: 'File': undeclared identifier
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(71): error C2228: left of '.ContentsSize' must have class/struct/union
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(71): note: type is 'unknown-type'
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(71): error C2228: left of '.Contents' must have class/struct/union
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(71): note: type is 'unknown-type'
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(71): error C3861: 'DEBUGPlatformWriteEntireFile': identifier not found
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(72): error C2065: 'File': undeclared identifier
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(72): error C2228: left of '.Contents' must have class/struct/union
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(72): note: type is 'unknown-type'
c:\users\dreamer\projects\cprograms\newGame\code\newGame.cpp(72): error C3861: 'DEBUGPlatformFreeFileMemory': identifier not found
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(87): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(87): error C2146: syntax error: missing ';' before identifier 'DEBUGPlatformReadEntireFile'
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(88): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(89): error C2146: syntax error: missing ';' before identifier 'Result'
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(89): error C2065: 'Result': undeclared identifier
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(98): error C2065: 'Result': undeclared identifier
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(98): error C2228: left of '.Contents' must have class/struct/union
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(98): note: type is 'unknown-type'
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(99): error C2065: 'Result': undeclared identifier
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(99): error C2228: left of '.Contents' must have class/struct/union
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(99): note: type is 'unknown-type'
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(102): error C2065: 'Result': undeclared identifier
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(102): error C2228: left of '.Contents' must have class/struct/union
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(102): note: type is 'unknown-type'
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(102): error C2660: 'ReadFile': function does not take 4 arguments
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(106): error C2065: 'Result': undeclared identifier
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(106): error C2228: left of '.ContentsSize' must have class/struct/union
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(106): note: type is 'unknown-type'
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(110): error C2065: 'Result': undeclared identifier
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(110): error C2228: left of '.Contents' must have class/struct/union
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(110): note: type is 'unknown-type'
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(110): error C3861: 'DEBUGPlatformFreeFileMemory': identifier not found
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(111): error C2065: 'Result': undeclared identifier
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(111): error C2228: left of '.Contents' must have class/struct/union
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(111): note: type is 'unknown-type'
c:\Users\dreamer\Projects\CPrograms\newGame\code\win32_newGame.cpp(130): error C2065: 'Result': undeclared identifier


I am debugging through vs2015 so if the /Wv:18 is supposed to help me, i can't figure out how to place it because wherever I put it, it produces the same errors.
Any help would be greatly appreciated.

Edited by a_dreamer on Reason: clarification
Whitespace is significant in the 'set' lines you have. The first line defines the variable 'CommonCompilerFlags ' instead of 'CommonCompilerFlags'. If you prepend 'echo' to your cl line you'll see it.

1
2
set CommonCompilerFlags=-MT -nologo -Gm- -GR- -EHa- -Od -Oi -WX -W4 -wd4201 -wd4100 -wd4189 -wd4456 -DNEWGAME_INTERNAL=1 -DNEWGAME_SLOW=1 -DNEWGAME_WIN32=1 -FC -Z7 -Fmwin32_newGame.map
set CommonLinkerFlags=-opt:ref user32.lib gdi32.lib
@royh Thank you so much, I don't work with batch that often so the information was super helpful. It's all working now