I just started using Code Runner quite recently and for some reason it won't compile my C program.
The Error is as followed:
Undefined symbols for architecture x86_64:
"_rush", referenced from:
_main in main-f9aa06.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
main.c
#include <stdio.h>
int ft_putchar(char c);
void rush(int x, int y);
int main(void){
int x, y;
scanf("%i", &x);
scanf("%i", &y);
rush(x, y);
return (0);
}
ftputchar.c
#include <unistd.h>
int ft_putchar(char c){
write(1, &c, 1);
return (0);
}
rush.c
int ft_putchar(char c);
void top_bottom(int n){
int i = 0;
ft_putchar('A');
while(i < n - 2){
ft_putchar('B');
i++;
}
ft_putchar('C');
ft_putchar('\n');
}
void rush(int x, int y){
if(x > 1 && y > 1) {
int j, i;
j = 0;
i = 0;
top_bottom(x);
while (i < y - 2) {
ft_putchar('B');
while (j < x - 2){
ft_putchar(' ');
j++;
}
j = 0;
ft_putchar('B');
ft_putchar('\n');
i++;
}
top_bottom(x);
}
if(x < 1 || y < 1){
return ;
}
if(x == 1 && y == 1){
ft_putchar('A');
ft_putchar('\n');
}
if(x > 1 && y == 1){
top_bottom_03(x);
}
if(x == 1 && y > 1){
int i = 0;
ft_putchar('A');
ft_putchar('\n');
while(i < y - 2){
ft_putchar('B');
ft_putchar('\n');
i++;
}
ft_putchar('A');
ft_putchar('\n');
}
}
Code Runner v2.3
However, when I used XCode to compile and run the code it works perfectly fine.
Also if I place everything into the main.c file then the code runs and compiles perfectly.