VS Code shows error in cs50.h header file downloaded from GitHub

120 views Asked by At

I have a very slow internet connection (computer too for that matter) and thus have been trying to use CS50 library locally. I download the source files from: https://github.com/cs50/libcs50/ and put both cs50.h and cs50.c in my project directory. Everything seems to work fine until I compress. GCC gives me this error message:

C:\Users\{user-name}\AppData\Local\Temp\cclUSb5a.o:plurality.c:(.text+0xe7): undefined reference to `get_int'
C:\Users\{user-name}\AppData\Local\Temp\cclUSb5a.o:plurality.c:(.text+0x110): undefined reference to `get_string'
collect2.exe: error: ld returned 1 exit status

I use VS Code and when I went to check the cs50.h header file, it says it expected "{" in between what seems like two function declarations.

char get_char(const char *format, ...) __attribute__((format(printf, 1, 2)));

I checked GitHub. Someone submitted an issue concerning this; it hasn't been fixed yet.

I have basic very basic knowledge of C and I have no idea how to fix this syntax error(?). I was hoping if someone could solve this. Thanks in advance!!

0

There are 0 answers