EDIT My problem is solved Thanks all very much the problem was that I only included cs50.h but didn't include cs50.c and that the library I had was an old one containing only GetInt but not get_int when I downloaded the new library everything worked
I'm taking CS50x course and I want to use get_int
function which is included in cs50 library on VS code ...
I downloaded cs50 library and copied cs50.h and cs50.c to d:\MinGW\bin
my code is
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int age = get_int("Age?");
int days=age*365;
printf("Your age is %i which means that you are %i days old", age, days);
}
when I try to compile it using
gcc 0.c -o 0
it writes
0.c: In function 'main':
0.c:7:15: warning: implicit declaration of
function 'get_int' [-Wimplicit-function-declaration]
7 | int age = get_int("Age?");
| ^~~~~~~
d:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\AbdoMAD\AppData\Local\Temp\ccTefKbe.o:0.c:(.text+0x15): undefined reference to `get_int'
collect2.exe: error: ld returned 1 exit status
the auto complete of vs code doesn't have get_int
but it has GetInt
But when I use it and the code is
#include <stdio.h>
#include <cs50.h>
int main(void)
{
printf("Age?")
int age = GetInt();
int days=age*365;
printf("Your age is %i which means that you are %i days old", age, days);
}
it returns
d:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\AbdoMAD\AppData\Local\Temp\cc3NVsiz.o:1.c:(.text+0x1a): undefined reference to `GetInt'
collect2.exe: error: ld returned 1 exit status
What should I do to use get_int or at least GetInt in VS code??