I'm writing my first makefile. I wanted to link 2 files together. test.c and main.c. test.c includes a test.h as well as a header file, conio.h.
So far I've tried adding the header file to the paths returned after the failing make command, as well as adding the path to the header file in the command itself. For reference I'm using git bash. To add the make command to git bash I needed to add it directly to the bin folder of gits mingw, but it is looking program files x86 / mingw, which also contains conio.h
Do I need to link it to some kind of library instead. Any help in the matter would be appreciated.
gcc main.o test.o -o test -lconio
C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.1.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lconio
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:7: main] Error 1
main.c
#include "test.h"
int main() {
char c = inputChar();
return 0;
}
test.c
#include "test.h"
#include <conio.h>
void printChar(char casd)
{
_putch(casd);
}
void printString(const char *c) {
for (const char* s = c; *s != 0; s++) {
printChar(*s);
}
printChar('\n');
}
char inputChar() {
char c = _getch();
printChar(c);
return c;
}
test.h
void printChar(char);
void printString(const char *c);
char inputChar();