M
ake your PC ready to run codes in C language
How to use CS50 library in your local machine offline
Here are three videos presented by someone, they will guide you to make your PC ready to run C files.
How to Download and Install Visual Studio Code ( VS Code ) on Windows 10
How to Download and Install C Cpp Toolset ( gcc g++ gdb ) in Windows 10
using mingw-w64 and msys2
How to Set up Visual Studio Code for C and C++ Programming
After watching the above videos and following the steps in them, you can apply the following steps in order to use CS50 library for implementing codes written in C language in your local machine offline.
- Download the zip file from Github Release, https://github.com/cs50/libcs50/releases
- Unzip it, locate to libcs50/src/, you can get cs50.h and cs50.c
- Copy cs50.h and cs50.c in the Workspace
- Create and save a C file which uses cs50 libraries in the Workspace. We can call it hello.c, hello.c should be with cs50.h and cs50.c in the same folder in the Workspace
- To use cs50.h in your hello.c file, please write #include "cs50.h" (pay attention to the quote mark)
- Use this command gcc -o hello hello.c cs50.c to compile Source code --> Machine code
- Run hello.exe (.\hello in Terminal) to make sure it work
Comments
Post a Comment