Handmade Hero»Forums»Code
Brad B
7 posts
Week 17 DEBUGPlatformWriteEntireFile error
Edited by Brad B on
Hi all,

I've been following along writing the code as I went along with each day. I started having a few problems around Day 15 but worked through them and all seemed to be working. However, I had changed a few things from Casey's code to get it to work. I'm using VS 2015 Community and was able to compile within VS and at the command prompt using the bat files. Everything worked but it wasn't like Casey's. So I backed up my version, went to the download files and extracted Day 17 and copy pasted all the code into my project. It is now identical to Casey's and I have 107 errors. Most of these seem to be related to the location of the definition of the alternate type definitions for integer values. Casey has them in win32_handmade.cpp but the definitions are used in handmade.cpp which only calls to handmade.h which doesn't include the definitions or an include to win32_handmade.cpp. I took all the typedefs and #defines and moved them to handmade.h and now all files can find the definitions and defines. I do not know if that's ok to do to be consistent with Casey but I cannot figure out how handmade.h or handmade.cpp can find the typedefs when they are in win32_handmade.cpp.

That took care of all the errors except for one. This one is weird and I suspect it's a rolling error. I fix this and two others pop up, etc. So here it is. I conpile and get this message.

handmade.cpp(113): error C2129: static function 'bool32 DEBUGPlatformWriteEntireFile(char *,uint32,void *)' declared but not defined

The code is identical to Casey's. It's defined in handmade.cpp and declared in handmade.h at line 66 not 113 which is one line past the end on my file. I made sure all the internals were specified in project properties and they are active and working except for this one call. Any help would be appreciated. I can provide more detail about my configuration if needed. I really want to move forward but do not want to hack my way through and try to make something work when down the road it becomes a problem because it's different then Casey's solution. I'm still looking and also cannot figure out why that function is set to bool32.

I should add that my I was able to get my version to work when i disabled the preprocssor definitions completely. Then DEBUGPlatformWriteEntireFile and the rest of the "debug_read_file_result" worked. I commented out the HANDMADE_INTERNAL and ENDIF line and removed the definitions from the properties menu. It compiles and runs but "debug_read_file_result" is not limited to debug. test.out did get created...but the way it is it will be created every time not just in debug and HANDMADE_INTERNAL doesn't exist so that's not where I want to be either.
Andre
15 posts
Week 17 DEBUGPlatformWriteEntireFile error
Given the list of problems you're having compiling Casey's code, I suspect you are not using a single translation unit build. The code for Day 17 should compile with few, if any, errors on VS 2015. Are you compiling each of the .cpp files separately and linking thereafter? Remember, all of Casey's "internal" (i.e., static) functions have, fittingly, internal linkage; so other translation units won't be able to see their definitions.
Brad B
7 posts
Week 17 DEBUGPlatformWriteEntireFile error
Thanks. I had previously done a search on this forum before the new format and had found and downloaded VS 2015 config that someone else had posted. Going over all that now and making adjustments.