Trevor
1 posts
Handmade Hero Day 034 - Tile Map Memory: Multiple Compilation errors
Edited by Trevor on Reason: Initial post
Hi Everyone!

I have been following along with the series and I just run into some issues that I cant seem to find the solution to.

I seem to be having errors with the following code:
 1 2 3 4 5 1. GameState->World = PushStruct(&GameState->WorldArena, world); 2. world *World = GameState->World; 3. World->TileMap = PushStruct(&GameState->WorldArena, tile_map); 4. tile_map *TileMap = World->TileMap; 

and later

 1 2 5. SetTileValue(&GameState->WorldArena, World->TileMap, AbsTileX, AbsTileY, (TileX == TileY) && (TileY % 2) ? 1 : 0); 

this throws the following errors:
(3.): error C2679: binary '=': no operator found which takes a right-hand operand of type 'tile_map *' (or there is no acceptable conversion)
(3.): note: while trying to match the argument list '(tile_map, tile_map *)'
(3.): note: while trying to match the argument list '(tile_map, tile_map *)'
(4.): error C2440: 'initializing': cannot convert from 'tile_map' to 'tile_map *'
(4.): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

(5.): error C2665: 'SetTileValue': none of the 2 overloads could convert all the argument types
(5.): note: while trying to match the argument list '(memory_arena *, tile_map, uint32, uint32, int)'

Here is the video of him writing with code, he dosen't really change this but ads '&' later.

There are a few more but these are the main ones I ran into. I assumed my code was the issue, so I literally copied and pasted Caseys code from that stream and it would not compile either.

My best guess is that i might not have have the right version of the compiler? Im using the same software "Visual Studio 2015" but maybe its using a different version of something?

Found that Compiler version is "19.00.24215.1 for x86"

At this point there is nothing different code wise but it has to be something with the compiler right, because this is all Caseys Code?

Any help would be awesome.

Thanks,
Mārtiņš Možeiko
2265 posts / 2 projects
Handmade Hero Day 034 - Tile Map Memory: Multiple Compilation errors
It seems the type of World->TileMap is just "tile_map", not a pointer - "tile_map *".
Is that correct?
Because your code assumes World->TileMap is a pointer. You cannot allocate memory with PushStruct and assign to non-pointer type.