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

int main(void)
{
    string name = get_string("what is your name?\n");
    printf("hello,%s\n",name);
}
  • When I compile the above code using command "clang myfilename.c" the following error shows up "/tmp/helloworld-19a552.o: In function main': helloworld.c:(.text+0x19): undefined reference toget_string' clang: error: linker command failed with exit code 1 (use -v to see invocation)"

What does above error mean and why does it show up?

1

If you use the IDE, the easiest way is to use the make command, if not, you must use the -lcs50 option when compiling to avoid the error indicated

0

You need to link in cs50 file also using -l

Clang myfilename.c -lcs50

Or simply use make command

Make myfilename

You must log in to answer this question.

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