# How can I get the cs50.h to run in Visual Studio Code?

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.

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

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,

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>

clang hello.c -o hello -lcs50

• 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

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>