Undefined symbols error when using a header file
问题 I'm getting the following error and can't for the life of me figure out what I'm doing wrong. $ gcc main.c -o main Undefined symbols: "_wtf", referenced from: _main in ccu2Qr2V.o ld: symbol(s) not found collect2: ld returned 1 exit status main.c: #include <stdio.h> #include "wtf.h" main(){ wtf(); } wtf.h: void wtf(); wtf.c: void wtf(){ printf("I never see the light of day."); } Now, if I include the entire function in the header file instead of just the signature, it complies fine so I know