I've created a new workspace on cloud9, and ran update50 as suggested in the answer to this similar question: Undefined reference to get_int

However, I still receive the exception 'undefined reference to `get_int'' in my terminal with this code that was copied/pasted from Week 1's notes.

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

int main(void)
    int i = get_int("Integer: ");
    printf("hello, %i\n", i);

I've tried a few other things like resetting the workspace to default and executing update50 again, but the problem persists.

1 Answer 1


On which version of the workspace are you? The current version as of 2017-11-13 is v125. If update50 doesn't end in an error message, you probably are at that version.

Also, how do you compile? The default of

make hello

would use environment variable LDLIBS with content -lcrypt -lcs50 -lm. Here the -lcs50 is relevant, it tells the linker (which is invoked by the compiler) to link against library cs50.

The minimal compile command line would be

clang hello.c -o hello -lcs50

but better use make (which takes the target, not its source, so run make hello, not make hello.c).

  • Hi, using make hello worked fine. I tried clang hello.c, which worked fine for the Hello World example but failed for the Get Integer one, now I know why...thanks for the help.
    – JohnWick
    Commented Nov 14, 2017 at 0:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .