Day 011

Sorry guys, Iam just in day 11 with the Hero, I got a problem with the compilation in VS12

this appear to be the error (the internal instruction in handmade.cpp and .h)

INTERNAL void GameUpdateAndRender(game_offscreen_buffer *Buffer, int BlueOffset, int GreenOffset);

Error 1 error C2144: syntax error : 'void' should be preceded by ';'
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

do you know what is it?

thanks!
xx
It looks like it's either getting an error from the previous line or you have a typo in that current line. Are you sure you have your #define set as:

#define INTERNAL static

and not

#define internal static

Other than that I can't be of much more use without seeing the previous lines of code, but from my personal experience with handmade hero, when I get errors like that it's usually silly things like a typo or forgetting a semicolon on the line before.
Thanks StarchyPancakes, but I didn't touch the original code just paste from the download...

I don't what happened
In that case I'm out of ideas, sorry I couldn't be of more help.
Well there is no INTERNAL in the source, only internal. I'd suggest making sure you did copy paste everything right (use a diff tool if you can) or just double check by hand for missing braces and semi-colons. I had something similar, took me 2 hours to find by hand where a diff tool could've cought it a lot faster.
I had a similar error whenever I tried compiling handmade hero during the first few weeks, due to using an older version of visual studio that didn't have all the headers Casey was using... however in my case I believe it was stdint.h that was missing, which would have caused the same error on day 10.

If you haven't tried compiling every day before 11 test it to make sure the error begins on day 11, and then try and figure out what is missing (and if you can, upgrade to vs community..)

Edited by Iker Murga on
You have to set hanmadeinternal as compiler flag, or else it'll fail. Search the forum for a correct vs solution file. And remember to build 64 bit!
Ran into the same problem myself. The solution was to create a header file called "define.h", and move all of the #defines and typedefs to there. Then I just include the define.h file at the top of handmade.h.

Plus this way there's no need to fiddle with compiler parameters (since I'm using XCode anyway).

The solution was to create a header file called "define.h", and move all of the #defines and typedefs to there. Then I just include the define.h file at the top of handmade.h.

This was what I ended up having to do. I thought stdint.h was some win32 specific header, but it seems it is a header file in the C standard library

A little frustrating to follow this stuff 8 years later, using new windows APIs, VSCode and MSVC and having to figure out why Casey's code doesn't compile. But I guess that's the learning


Replying to Azurecat (#10883)