KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've perused the possible duplicates, however none of the answers there are sinking in. tl;dr: How are source and header files related in C ? Do projects sort out declaration/definition dependencies implicitly at build time? I'm trying to understand how the compiler understands the relationship between .c and .h files. Given these files: header.h : int returnSeven(void); source.c : int returnSeven(void){ return 7; } main.c : #include <stdio.h> #include <stdlib.h> #include "header.h" int main(void){ printf("%d", returnSeven()); return 0; } Will this mess compile? I'm currently doing my work in NetBeans 7.0 with gcc from Cygwin which automates much of the build task. When a project is compiled will the project files involved sort out this implicit inclusion of source.c based on the declarations in header.h ?
Tags (comma-separated)
Save Edits
Cancel