Skip to content
Advertisement

Undefined reference error while compiling

I’m trying to compile a project that has multiple *.c files and *.h file when I type the following command:

JavaScript

the hdr folder is where the *.h files are located, the .o files are created but when I try to link them using the command:

JavaScript

I see errors

JavaScript

Advertisement

Answer

JavaScript

Using a Makefile is very common for this task

example (untested) Makefile:

JavaScript
Advertisement