cs50/libcs50

`make` `hello.c:(.text.startup.main+0xf): undefined reference to `get_int'`

danli349 opened this issue · 1 comments

My source file is hello.c:

#include <stdio.h>
#include <cs50.h>

int main(void)
{   
    int n = get_int("Prompt: ");
    printf("hello world! %d \n", n);
}

I can compile it using gcc hello.c -lcs50 -o hello, and run ./hello successfully.

but I failed to compile it using make hello:
the error is

hello.c:(.text.startup.main+0xf): undefined reference to `get_int'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: hello] Error 1

How should I fix it?