Header files ignored when compiling

SGDK only sub forum

Moderator: Stef

Post Reply
wcr
Newbie
Posts: 1
Joined: Mon Oct 19, 2020 9:48 pm

Header files ignored when compiling

Post by wcr » Sun Jun 13, 2021 5:06 pm

Hello, I'm relatively new to SGDK and C in general, and I'm trying to make a game with a separate file for the player (player.h) (already included in main.c) so that main.c doesn't get too messy. However, even though it works for the most part, it seems that the compiler only detects changes when I type or erase something in main.c, but not when I change things in other files.
So if I change something in player.h, when I compile the game, nothing changes, then I have to change something in main.c for it to work, which is a bit inconvenient. I apologize if this has been asked before but I couldn't find anything, so any help would be appreciated.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Header files ignored when compiling

Post by Stef » Tue Jun 15, 2021 9:30 am

.h file should only make variables and functions visibles to others units so you shouldn't directly put your code into the .h file but in player.c file instead.
Try to look how this is made in SGDK (src folder contains .c files while inc contains .h files) and mimic it in you can.
Still with the dependency generation (.d files) GCC should be able to rebuild main.c as soon you change the player.h file so i wonder why this is not the case here :?

Post Reply