Register
Handmade Hero»Forums»Code»Help with Day 015 - File IO - static visibility issue with Visual Studio 2019
10 posts
Help with Day 015 - File IO - static visibility issue with Visual Studio 2019
2 weeks ago Edited by echu on Nov. 26, 2019, 12:01 a.m.
I'm using Visual Studio 2019 to try and compile the code, but I ran into C2129 static function 'void DEBUGPlatformFreeFileMemory(void *)' declared but not defined in line 100 of handmade.cpp. Line 100 doesn't exist, since the last line of code in that file is line 99. The underlying issue appears that Visual Studio thinks the pieces of code are in different translation units. Visual Studio even allows me to jump to the function declaration in win32_handmade.cpp by crtl+clicking from handmade.h. But GameUpdateAndRender is in a similar situation, and no strange visibility issues occur!

Please see the attached images here .

Removing the internal keyword from handmade.h on those 3 functions appear to allow the code to work with parity with the command-line build and tutorial, but I'm scared to diverge too much from what Casey has with these quick "hacks" for sake of unrecoverable incompatibilities down the line. Still, the question remains on why Visual Studio doesn't see these functions in the same translation unit! VS seems to want to add the macro internal to a "hint file". I've never seen that before, and it seems like some strange visibility issues around that are happening.
Marc Costa
45 posts
Help with Day 015 - File IO - static visibility issue with Visual Studio 2019
2 weeks ago
Casey's build model differs from VS' default one. If you want to use VS to follow along, you'll need to change how it builds the source code. I believe this thread describes the changes you'll need: https://hero.handmade.network/for...using_vs_instead_of_a_text_editor
Mārtiņš Možeiko
1990 posts / 1 project
Help with Day 015 - File IO - static visibility issue with Visual Studio 2019
2 weeks ago
Also Casey is using VS 2013. Newer VS version have compiler with different set of warnings / errors. You will need to modify code to work around compiler errors or adjust compiler arguments to ignore warnings.
10 posts
Help with Day 015 - File IO - static visibility issue with Visual Studio 2019
1 week, 6 days ago Edited by echu on Nov. 27, 2019, 6:07 a.m.
Thanks, that was helpful. I'm thinkering with Visual Studio and got it semi-working with all switches (day 16) with the exception of the static visibility. I'll probably fall back to simple-command line builds, since they always work.