Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a troubleshooting option. #265

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,35 @@ $ yum install libcs50
### From Source (Linux and Mac)

1. Download the latest release from https://github.com/cs50/libcs50/releases
1. Extract `libcs50-*.*`
1. `cd libcs50-*`
1. `sudo make install`
2. Extract `libcs50-*.*`
3. `cd libcs50-*`
4. `sudo make install`
telometto marked this conversation as resolved.
Show resolved Hide resolved

By default, we install to `/usr/local`. If you'd like to change the installation location, run
`sudo DESTDIR=/path/to/install make install` as desired.

## Troubleshooting
1. If, when compiling a program, you see `/usr/bin/ld: cannot find -lcs50`:
Add `export LIBRARY_PATH=/usr/local/lib` to your `.bashrc`.
1. If, when compiling a program, you see `fatal error: 'cs50.h' file not found`:
2. If, when compiling a program, you see `fatal error: 'cs50.h' file not found`:
Add `export C_INCLUDE_PATH=/usr/local/include` to your `.bashrc`.
1. If, when executing a program, you see `error while loading shared libraries: libcs50.so.8: cannot open shared object file: No such file or directory`:
3. If, when executing a program, you see `error while loading shared libraries: libcs50.so.8: cannot open shared object file: No such file or directory`:
Add `export LD_LIBRARY_PATH=/usr/local/lib` to your `.bashrc`.
4. If, when compiling a program, you see something similar to the following:
telometto marked this conversation as resolved.
Show resolved Hide resolved
```
cc calculator.c -o calculator
/usr/bin/ld: /tmp/ccst5Jkx.o: in function `main':
calculator.c:(.text+0x13): undefined reference to `get_int'
/usr/bin/ld: calculator.c:(.text+0x25): undefined reference to `get_int'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: calculator] Error 1
```
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a `Makefile` inside the project folder, and paste the following:
telometto marked this conversation as resolved.
Show resolved Hide resolved
```
LDLIBS += -lcs50
telometto marked this conversation as resolved.
Show resolved Hide resolved
CC := clang
CFLAGS += -Wall -Wextra -Werror -pedantic -std=c11
```

Close and reopen any terminal windows.

Expand Down