0

I just began CS50 and was trying to copy some of the examples done on the lecture video. I use opensuse tumbleweed(also a little new to it) and I had installed the cs50 c library just as the documentation asked. My code is:

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

int main(void)
{
    string answer = get_string("What's your name?");
    printf(answer);
}

and I get an error that is this in my terminal:

/usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /tmp/cciFW8gc.o: in function `main':
hello.c:(.text+0x18): undefined reference to `get_string'
collect2: error: ld returned 1 exit status

I get this error whether I run it in my vscode or terminal and am not sure whether I installed the library incorrectly or included it wrong. I did further testing and saw that "string" works and I understand that is also a part of the library, so I guess the issue is with get_string. Any help is appreciated!

1

0

You must log in to answer this question.

Browse other questions tagged .