[von selbst gelöst] Programmieren mit Headerdateien + Kompilieren
-
Das Problem:
Ich will mit Headerdateien arbeiten und die Dateien dann mit dem gcc kompilieren. Ich hab' jetzt schon so lang im Internet gesucht, finde aber nirgends eine Antwort.
Ja, das Programm ist nur mal für einen Testzweck:
Hauptprogramm (hallo.c)
#include <stdio.h> #include "hallo.h" int main(void) { printf("Hallo Linux!\n"); hallo(); return 0; }
Headerdatei (hallo.h)
void hallo(void);
Die Funktion (in hallo_funktion)
#include <stdio.h> #include "hallo.h" void hallo(void) { printf("Hallo Linux!"); }
Wie kompilier ich das jetzt zu einem Programm zusammen.
Mit einer .c- Datei war's ja so:
gcc hallo.c -o hallo
Schonmal danke
Thomas
-
// Update:
So
gcc -o linux hallo.c hallo_funkt.c