14

If you aren't going to use the appliance, you'll need both the cs50.c and cs50.h files. Here is cs50.c Here is cs50.h For specific OS-based instructions on how to use the CS50 Library in your own programs, please read the appropriate section of the CS50 Library Manual on Harvard's site. (Thanks Raphael for the comment.) You may run into problems not ...


10

A library's header file (the one that ends with the .h extension) doesn't contain function definitions. Instead, it contains the library's resources that are available for you to use. These resources include Function declarations (aka prototypes). Variables. Structs. Type definitions. For more information, you may have a look at this answer and watch the ...


10

Compiling a library is not as easy as compiling an executable. Let's analyze the steps together. We need to compile our library source code into position-independent code (PIC): gcc -c -Wall -Werror -fpic cs50.c Now we need to actually turn this object file into a shared library. We’ll call it cs50.so: gcc -shared -o libcs50.so cs50.o As you can see, ...


9

Here are the instructions for installing CS50 library in your OS: Linux First become root, as with: su - // Fedora, RedHat, CentOS sudo -s // Debian, Ubuntu, Mint //edited from sudo su -, use sudo -s on Ubuntu. Then install the CS50 Library as follows: yum -y install gcc // Fedora, RedHat, CentOS apt-get install gcc // Debian, Ubuntu, Mint wget ...


8

Update: please follow the instructions per https://github.com/cs50/libcs50#installation instead! A shorter answer could be this. Debian, Ubuntu First become root, as with: sudo su - Then install the CS50 Library as follows: apt-get install gcc wget http://mirror.cs50.net/library50/c/library50-c-5.zip unzip library50-c-5.zip rm -f library50-...


8

Did you compile it using make? If not (and why not?) did you remember to include the -lcs50 clang compile flag that links the library?


7

Follow the steps below, and see if it helps... [Optional, you may choose to not install Xcode as long as you have any text editor] On a Mac, make sure you have installed Xcode first of all. It's available on the Mac App Store for free, but is a hefty download. So, once downloaded, move further. Now, download the CS50 library from here. Now are the ...


6

First, you'll need to install the cs50 library. Follow this link for more information about how you can install the cs50 library on Fedora! Second, you need to link the library binary file by providing -lcs50 when compiling. So your command should look something like cc condition0.c -lcs50 -o condition0 Notice that you'll probably need a Makefile in case ...


6

I have had the same problem in CS50 2015 VMware appliance. I even include CS50.h library like that: #include<cs50.h> But I was keep getting error 1 of Undefined reference to `GetString' or 'GetInt' etc. What I did is just updating the appliance using this command on Gedit: update50 Update process continued for several minutes. As updates completed, ...


5

Download the cs50 from: http://mirror.cs50.net/library50/c/library50-c-5.zip Extract it. (You will get two files cs50.c and cs50.h) Now copy both the files to your default library folder. (which includes your stdio.h file) Now while writing your program use: #include < cs50.c > You can also copy the files to the folder containing your helloWorld.c file. ...


5

Did you follow the instructions in pset1 that said to run update50 first? There's an update that will fix your gedit built-in terminal to use the correct compiler commands. Also, jharvard@ubuntu is perfectly fine.


5

Just got it and posting if it might come to help. You got to do two things: A. Add library to the compiler: Right click on the project Click on the "Build options" Click on "Search Directory" Click on "Compiler" Add the library folder path B. Add library header files and source file to your project: Right click on the project Click "Add files recursively"...


4

An easier method is to use my CS50 tools setup if you're on Ubuntu or Fedora. Open a terminal in your download directory, and run sudo sh cs50_setup_ubuntu.sh or sudo sh cs50_setup_fedora.sh depending which OS you're on Download the file here: Ubuntu (and Ubuntu derivative, such as Linux Mint etc): https://www.dropbox.com/s/6wv06ejnw7ryqf6/...


4

stdio.h is a header file from the C Standard Libraries, and their implementations are in the libc.a file, due to his common and extended use, this file is automatically linked by the compiler as if the -lc argument was especified on the compiler command like this: clang hello hello.c -lc On the other hand, the cs50 library is and external library created ...


3

First of all, these are not the libraries! These are known as libraries' header files (aka declaration files). You may have a look at this answer to learn a little bit more about them! The header files for the C standard library are located in the default include directory. You may reach this directory by opening up the terminal and executing the following ...


3

The required header files are included in both the pset4.zip and the src5m.zip. Bounce is part of the latter though, so I would say to just run unzip src5m.zip in your Dropbox folder again, and watch for any errors on unzip. upon successful unzip, the gevents.h file will be in ~/Dropbox/src5m/spl/include folder


2

Head over to https://github.com/cs50/libcs50. There you will find both files plus instructions for how to install the library so that you can compile your code with cs50.h included. If you're using Ubuntu, it's easy, just execute the following commands in a terminal: $ curl -s https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | sudo ...


2

Can confirm this works. Thank you for this! :)


1

Per the error message: did you mean get_string? There is no GetString in the CS50 library any more; it was changed a few years ago to get_string. Try that.


1

Just execute the following command $ sudo rm -f /usr/local/include/cs50.h /usr/local/lib/libcs50.a To install the latest version of the CS50 C library on Ubuntu, execute the following commands $ sudo add-apt-repository "deb http://mirror.cs50.net/ide50/2015/dists/trusty/main/binary-amd64/ /" $ sudo apt-get update $ sudo apt-get install lib50-c


1

When you are using CS50 IDE with inbuilt CS50 SQL library files then it's easier to use CS50::query() function. In normal situations, eg in a linux machine, you can use only the query() function. CS50::query() function saves the time over query() which is $con = mysqli_connect('localhost',$username,$password,$database); $cash = mysqli_query($con,"SELECT ...


1

Much appreciated! Worked perfectly. Only thing I would like to add is the library can be found here https://github.com/cs50/libcs50


1

Before you try to unzip the library, do you actually have the file on your computer? Have you verified it with ls command, or find -name library50*? My guess is that the file is not on your system. Check the website at https://manual.cs50.net/library/ for instructions. You can also search this forum for library50 for additional info. If this answers ...


1

There is also instructions in the Github repo. But ensure to install rubygems before running gem install asciidoctor


1

In order to use the CS50 library, download it from here. Now, copy the files cs50.h and cs50.c to any arbitrary folder. Right click on the project, and got to Properties --> Configuration Properties --> C/C++ --> General... Include the path of the folder where the header files are to the additional include directories. Afterward, simply using #include ...


Only top voted, non community-wiki answers of a minimum length are eligible