I downloaded both the cs50.c and cs50.h files from GitHub and put them in the folder where all the header files are. VSC even recognizes the #include <cs50.h> in the code but I get the error in the photo below.

enter image description here

I have even put the proper "Include Path" for the C/C++ extension provided by Microsoft. enter image description here

So now how do I get rid of the error and make this work?

  • i have the same problem i dont know what to do – Priyanshu Naskar Sep 27 '20 at 11:57
  • Alright I'm going to tell you something. Most of folks have provided enough solutions to solve this. But, you're expected to take off training wheels and explore deep waters in C. cs50 library is suitable if you're still in the earlier weeks solving psets in this course, but as you get more creative with designing final project/ other stuff, you're expected to use I/O functions from stdio.h. cs50.h is not a standard library and doesn't ship with C compilers – C-- Apr 14 at 17:39

Please take a look here in regard to the difference between angle brackets <> and double quotes " ": https://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename

Also, "cs50 library for c" installation docs might come handy: https://cs50.readthedocs.io/libraries/cs50/c/


I was able to get mine working on my Mac with Visual Studio Code as follow: Assuming you have Visual Studio already installed and with all C/C++ extensions required for compiling and running C codes,

1a. Download the CS50 Library from https://github.com/cs50/libcs50/releases

1b. Extract/unzip the downloaded zipped folder

2a. Open Terminal and change directory to the unzipped CS50 library folder. For example if folder is on desktop and the folder is named libcs50-10.1.0 , then terminal command should be:

cd desktop/libcs50-10.1.0

2b. Still in terminal after changing directory, then run the command:

sudo make install

3a. After installation, close terminal, go to visual studio and write your C program

#include <cs50.h>

3b. Link cs50 when compiling your code with clang. Example if your file name is hello.c

clang hello.c -o hello -lcs50

run your code

  • Thanks for this. But when I run runas(for windows) make install, it displays so many messages like "Enter user's password only when prompted. USER@DOMAIN is not compatible with /netonly. /profile is not compatible with /netonly." at the end, and doesn't do anything else. Any ideas on how to go about it? – Daniel Paul Sep 26 '20 at 23:47

Following are the steps to get the CS50 libraries installed in VSC in Windows 10 with mingw64 environment:

  1. Pre requisite: Install Mingw64 to set up VSC for C/C++ programming https://www.youtube.com/watch?v=rgCJbsCSARM

  2. Download libcs50-10.1.0 from github

  3. Extract cs50.h and cs50.c and copy them to C:\msys64\mingw64\include\

  4. In your source code, change #include <cs50.h> to #include <cs50.c>


in cs50.h has identifier __ attribute __ but in vc++ it is called __declspec and it is Microsoft specific. the grammer is different too. the grammer for __declspec is provided by Microsoft https://docs.microsoft.com/en-us/cpp/cpp/declspec?view=msvc-160

so cs50.h needs to be rewritten in order to work on VC++

New contributor
Sen Pei is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

you just need to change #include <cs50.h> to <cs50.c>

  • You should never include a source file. You include the header file, and link the library. -lcs50 – Fuelled_By_Coffee May 11 at 17:18

You must log in to answer this question.

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