Hi,
I'm following an online computer science course which requires me to compile a static library (cs50.h) on my own system which provides additional functionality not included in stdio.h
here are the commands I used to do so
gcc -c -ggdb -std=c99 cs50.c -o cs50.o
ar rcs libcs50.a cs50.o
rm -f cs50.o
sudo cp cs50.h /usr/local/include
sudo libcs50.a /usr/local/lib
these commands ran with no errors
I then tried to compile the following source code
#include <cs50.h>
#include <stdio.h>
int
main (int argc, char * argv[])
{
printf("Please enter your name: ");
string name = GetString();
printf("Pleased to meet you, %s\n", name);
}
I received the following error message:
Undefined symbols:
"_GetString", referenced from:
_main in ccqHXJVw.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Could anyone tell me what this error message refers to and point me in the right direction as to where a mistake could have occurred?
Thanks
I'm following an online computer science course which requires me to compile a static library (cs50.h) on my own system which provides additional functionality not included in stdio.h
here are the commands I used to do so
gcc -c -ggdb -std=c99 cs50.c -o cs50.o
ar rcs libcs50.a cs50.o
rm -f cs50.o
sudo cp cs50.h /usr/local/include
sudo libcs50.a /usr/local/lib
these commands ran with no errors
I then tried to compile the following source code
#include <cs50.h>
#include <stdio.h>
int
main (int argc, char * argv[])
{
printf("Please enter your name: ");
string name = GetString();
printf("Pleased to meet you, %s\n", name);
}
I received the following error message:
Undefined symbols:
"_GetString", referenced from:
_main in ccqHXJVw.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Could anyone tell me what this error message refers to and point me in the right direction as to where a mistake could have occurred?
Thanks