I want to change the default options of make to be like the appliance one. I have installed clang and the cs50.h library but right now I compile the programs using clang hello_world.c -lcs50 -o hello_world for example. It would be nice if you can explain each command that should be included. The appliance one uses clang -ggdb3 -00 -std=c99 -Wall -Werror -argv-2.c -lcs50 -lm -o argv-2.
In Linux you can do:
export CC=clang export CFLAGS="-ggdb3 -O0 -std=c99 -Wall -Werror -lcs50 -lm"
and then run:
I don't use Windows, but I believe it uses set instead of export.
NB: If you want to be able to compile your psets without installing the appliance or the cs50 library, you can do this:
Dowload cs50 library from: http://mirror.cs50.net/library50/c/library50-c-5.zip
Copy cs50.c and cs50.h into the pset directory.
Set up your environment as follows:
export CFLAGS="-ggdb3 -O0 -std=c99 -Wall -Werror -lcs50 -lm -I. cs50.c"
Run: make [program name]
Don't tell CS50 folks I showed it to you ;)
export CC=gcc export CFLAGS="-ggdb3 -O0 -std=c99 -Wall -Werror" export LDLIBS="-lcs50 -lm"
Produce debugging information for use by GDB. This means to use the most expressive format available (DWARF 2, stabs, or the native format if neither of those are supported), including GDB extensions if at all possible.
Request debugging information and also use level to specify how much information. The default level is 2. Level 3 includes extra information, such as all the macro definitions present in the program. Some debuggers support macro expansion when you use -g3.
Reduce compilation time and make debugging produce the expected results. This is the default. (Is a optimization option)
Turns on all optional warnings which are desirable for normal code. At present this is -Wcomment, -Wtrigraphs, -Wmultichar and a warning about integer promotion causing a change of sign in "#if" expressions. Note that many of the preprocessor's warnings are on by default and have no options to control them.
Make all warnings into hard errors. Source code which triggers warnings will be rejected.
possibly loads a math library.