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 Sep 27, 2020 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, 2021 at 17:39

5 Answers 5


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>

  • This was the most stable way to do it locally. Worked fine for me on windows. Jan 7, 2022 at 23:44
  • Ah! Thank you, this solved it so fast after such a long time of trying to find a fix! 😃 Jun 11, 2022 at 11:45
  • Thanks. Finally a good answer after +1 hours of searching 💀
    – Tyssan
    Sep 30, 2022 at 14:08

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? Sep 26, 2020 at 23:47
  • and now sudo isnt available.SHIT MANNNN!!!!??!!!! Aug 10, 2022 at 16:28
  • Thank you sooooo much, this worked perfectly for me! ./make doesn't work but clang does which tripped me up a bit. Aug 17, 2022 at 11:53

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/


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++


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

  • 1
    You should never include a source file. You include the header file, and link the library. -lcs50 May 11, 2021 at 17:18
  • I know it works when you add source file but that doesn't solve the actual problem of 'header file not working' Aug 9, 2022 at 6:08

You must log in to answer this question.

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