make utility actually calls the
clang compiler with special options that can be set for a project.
When I run
make in the ide it actually runs the following:
clang -fsanitize=integer -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wshadow temp.c -lcrypt -lcs50 -lm -o temp
Most of that is unimportant to understand at the moment, but
clang to link the cs50 library code (the actual code for
get_string) with your code so you can call the function.
If you just use
clang string.c it won't work, because the actual library code will not be linked. When you
#include <cs50.h> that file has a function prototype for all of the functions in the library. Essentially, it is a list of functions that are available to use - but not the actual functions themselves. The
lcs50 option is telling
clang where those actual functions are.
The first couple of programs in the course used
clang to compile, just to show you what the actual compiler program was. Now that we are using cs-50 library functions, you're going to have to use
make OR type out the entire
clang command from above - which is why someone made the
make utility in the first place :) The
make utilty is important for MUCH MUCH more than changing the default name of the output file.