I’m making progress but without really understanding the big picture for now.

When you build a C project does it look for the header files first and then find a matching definition in a C file, then linking and compiling based on that?

I did an experiment where I changed the name of the .c file and it worked fine regardless of the name. So is it the header file name that matters the most?

I’m learning as I go so I apologize if I should have read this in a book or manual somewhere. If there is a helpful resource I would appreciate a link to it please. :)

@derickflorian Frequently C projects with more than one file are managed by a Makefile. You define the rules by which your project gets built based on what files depend on what other files to compile. When you run the make command, it will comprehend the dependencies, check the file time stamps, and figure out the minimum amount of work to build the project. There are also newer technologies that have developed, see CMake, ninja, tup and others as well as Visual Studio.

Follow

@PHolder Thanks for the link to the book and the explanation. I guess my IDE is generating a makefile for me so that explains a lot. I will look at CMake because I think that is the one I’ve heard about most and the K & R book.

I appreciate the explanation. I wasn’t fully appreciating what was going on below the surface. Thank you!

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.