2

I've been trying to import the cs50.h library by all ways to my mac or xcode with no luck, I followed the instructions on https://manual.cs50.net/library/ nothing is working

Do you have any suggestion ?

*I've attached all the steps I followed moreover the source code. **I tried to compile with terminal and Xcode compiler with no luck.

I'm running MacOS 10.12.3 and Xcode 8.2.1

Thanks,

enter image description here

enter image description here

enter image description here

enter image description here

1 Answer 1

2

I had this problem too.

I suspect this version of the cs50 library is the 2016 version. If you look at that version of cs50.h or cs50.c, the functions provided are named differently to the current functions, i.e. get_string() is named GetString() and get_int() is named GetInt() etc.

So you need to use different function names on your machine (at least until the latest cs50 library is provided), but you will also need to link the cs50 library at compile time by including the argument -lcs50 to clang, so you might say:

clang -lcs50 test.c -o test

You could also create a Makefile, put it in your working directory and use make to automate this process with the following code:

CC = clang
LIBS = -lcs50

%: %.c
    $(CC) $(LIBS) -o $@ $<
1
  • Thank you Ste that works Commented Feb 1, 2017 at 19:54

You must log in to answer this question.

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