Hello,
I have used C in the past. but have gotten EXTREMELY rusty at it. I currently have four files in my directory (ex.c, ex.h, menu.c, and menu.h).
menu.h is this:
Code:
#ifndef MENU_H
#define MENU_H
#include <stdio.h>
void print_header(void);
int get_choice(void);
#endif
menu.c is this:
Code:
#include "menu.h"
void print_header(void) {
printf("--- Chapter 1 Examples ---\n");
}
ex.h is this:
Code:
#include <stdio.h>
void ex_1(void);
and ex.c is this:
Code:
#include "ex.h"
#include "menu.h"
int main() {
print_header();
return 0;
}
Currently, I am trying to run print_header in ex.c to make sure everything works but I am getting a linkage error.
Code:
ex.c:(.text+0x9): undefined reference to `print_header'
collect2: error: ld returned 1 exit status
Can someone refresh why this is happening and how to fix it? Thank you