BETA Try the new lesson view
Theory

Three errors

Three errors that happen most often with modules. Cause each one, read what CLion says, and undo it with Ctrl+Z. The error message is in the Build window, and CLion also underlines compiler errors in the editor.

1. A forgotten #include

In main.c comment out #include "daytime.h" and build (Ctrl+F9):

main.c:7:17: error: implicit declaration of function 'read_time' [-Werror=implicit-function-declaration]
    7 |     int start = read_time();
      |                 ^~~~~~~~~

This is a compiler error: while translating main.c, it sees no declaration of read_time. The message has the file and the line.

2. A .c file forgotten in CMake

Put the #include back. In CMakeLists.txt take daytime.c out of add_executable and build:

ld.exe: main.c:(.text+0x6e): undefined reference to `read_time'
ld.exe: main.c:(.text+0xc2): undefined reference to `print_time'
collect2.exe: error: ld returned 1 exit status

This is a linker (ld) error: main.c compiled, but there's no definition anywhere. There's no line number, only .text+0x6e, a place in the object file. undefined reference almost always means: the .c file isn't part of the target, or the function was never written.

3. A function body in the .h file

Put daytime.c back into CMake. In daytime.h replace the declaration int is_time(int hour, int min); with the whole definition, body included, and delete it from daytime.c:

ld.exe: daytime.c:(.text+0x0): multiple definition of `is_time'; main.c:(.text+0x51): first defined here

The linker again: daytime.h is pasted into both main.c and daytime.c, so is_time is defined twice. The #ifndef guard doesn't help here: it protects against two inclusions into the same .c file, and these are two different ones.

How to tell them apart

in the message who where to look
file.c:line: error: the compiler in that file, on that line
undefined reference the linker CMakeLists.txt or a missing function
multiple definition the linker a body in a .h file or two definitions

Undo all three changes and make sure p07_duration works again. No commit is needed: the code is the same as after step 4.