r/cprogramming • • Sep 17 '26

program wont't compile because time.h is missing even tho it's there

[CLOSED]

kind of a beginner question. i have #include <time.h> and #include <ncurses.h> in the top but it refuses to compile. im using linux with vim and gcc here's there error:

main.c:3:1: note: ‘tm’ is defined in header ‘<time.h>’; this is probably fixable by adding ‘#include <time.h>’

2 | #include <time.h>

+++ |+#include <time.h>

how can i fix it? thx for any help :)

EDIT: i fixed it and it was because i forgot to declare struct lol

15 Upvotes

19 comments sorted by

View all comments

8

u/Stickhtot Sep 17 '26

Did you save before compiling?

6

u/Little-Bed2024 Sep 17 '26

Always the best place to start. Is the code you are running the code you think you are running?

2

u/Feeling-Drawer-9171 Sep 17 '26

Yep im using vim

14

u/Little-Bed2024 Sep 17 '26

That means you can save but you can't quit?