Hi,
I am following the CS50 online programming course on my own and I wanted to use the CS50 library which is being used in the course. I believe I finally managed to install it properly (I was lacking gc.h obviously at first). However, when I try to compile a file from one of the lectures, Terminal returns the following:
I am new to the world of programming, but I hope you will be able to point me towards a solution. Does it have something to do with the compiler not knowing what the function "GetString" does?
Anyway, the file I am trying to compile is this one (called h1.c):
Hope you can help,
Jesper
I am following the CS50 online programming course on my own and I wanted to use the CS50 library which is being used in the course. I believe I finally managed to install it properly (I was lacking gc.h obviously at first). However, when I try to compile a file from one of the lectures, Terminal returns the following:
Code:
mb:~ jdn$ gcc h1.c -lcs50
Undefined symbols:
"_GC_malloc", referenced from:
_GetString in libcs50.a(cs50.o)
"_GC_free", referenced from:
_GetString in libcs50.a(cs50.o)
_GetString in libcs50.a(cs50.o)
_GetString in libcs50.a(cs50.o)
"_GC_realloc", referenced from:
_GetString in libcs50.a(cs50.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
I am new to the world of programming, but I hope you will be able to point me towards a solution. Does it have something to do with the compiler not knowing what the function "GetString" does?
Anyway, the file I am trying to compile is this one (called h1.c):
Code:
#include <cs50.h>
#include <stdio.h>
int
main()
{
printf("State your name: ");
string name = GetString();
printf("O hai, %s!\n", name);
}
Hope you can help,
Jesper