From 899aaa03729fcc240da637a0d2777079a4cf9694 Mon Sep 17 00:00:00 2001 From: Zeno <65364211+telometto@users.noreply.github.com> Date: Mon, 6 Jun 2022 12:37:58 +0200 Subject: [PATCH 1/3] Added a troubleshooting option. Troubleshooting step if the `make` command fails. --- README.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3f9e611..cbb30c9 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ $ 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` 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. @@ -39,10 +39,25 @@ By default, we install to `/usr/local`. If you'd like to change the installation ## 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: +``` +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: *** [: calculator] Error 1 +``` +       Create a `Makefile` inside the project folder, and paste the following: +``` +LDLIBS += -lcs50 +CC := clang +CFLAGS += -Wall -Wextra -Werror -pedantic -std=c11 +``` Close and reopen any terminal windows. From 5aff2072ae3ac1e8a7d9e8f62360cd7b82d4954b Mon Sep 17 00:00:00 2001 From: Zeno <65364211+telometto@users.noreply.github.com> Date: Mon, 6 Jun 2022 16:29:48 +0200 Subject: [PATCH 2/3] Updated according to comments. Changes implemented according to repo owner's wish. --- README.md | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index cbb30c9..8d74e86 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ $ yum install libcs50 ### From Source (Linux and Mac) 1. Download the latest release from https://github.com/cs50/libcs50/releases -2. Extract `libcs50-*.*` -3. `cd libcs50-*` -4. `sudo make install` +1. Extract `libcs50-*.*` +1. `cd libcs50-*` +1. `sudo make install` 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. @@ -43,21 +43,8 @@ Add `export LIBRARY_PATH=/usr/local/lib` to your `.bashrc`. Add `export C_INCLUDE_PATH=/usr/local/include` to your `.bashrc`. 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: -``` -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: *** [: calculator] Error 1 -``` -       Create a `Makefile` inside the project folder, and paste the following: -``` -LDLIBS += -lcs50 -CC := clang -CFLAGS += -Wall -Wextra -Werror -pedantic -std=c11 -``` +4. If, when compiling a program, you see something similar to `undefined reference to 'get_int'`: +Create a `Makefile` inside the project folder, and paste the following `LDLIBS += -lcs50`. Close and reopen any terminal windows. From c198c9b0b4d7f367be71c3868a909366a8ab263b Mon Sep 17 00:00:00 2001 From: Zeno <65364211+telometto@users.noreply.github.com> Date: Mon, 6 Jun 2022 16:31:29 +0200 Subject: [PATCH 3/3] Explicit numbering fixed. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8d74e86..eaae812 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,11 @@ By default, we install to `/usr/local`. If you'd like to change the installation ## 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`. -2. If, when compiling a program, you see `fatal error: 'cs50.h' file not found`: +1. 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`. -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`: +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`: Add `export LD_LIBRARY_PATH=/usr/local/lib` to your `.bashrc`. -4. If, when compiling a program, you see something similar to `undefined reference to 'get_int'`: +1. If, when compiling a program, you see something similar to `undefined reference to 'get_int'`: Create a `Makefile` inside the project folder, and paste the following `LDLIBS += -lcs50`. Close and reopen any terminal windows.