What is the problem with printf for debugging
How do you use lldb(mac) or gdb(linux)?
Compiling:
clang -g -O0
Then run the executable in the debugger:
lldb a.out
What are the basic lldb commands?
Why use a a Makefile?
Single-file programs do not work well when code gets large
Large programs are split into multiple files:
What are bad ways to compile programs with modules?
How do you work around having similar variables or function names when compiling multiple files
How is static used for variables/functions and inside functions
static used on variable or function makes it not visible or accessable by other files.
Inside a function makes the variable maintain it’s value and doesn’t reset after function calls
What is make?
A utility for automatically compiling executables and libraries from source code
What is makefile?
What are the makefile rule/syntax
How do makefile variables work?
define a variable:
NAME = value
$(NAME)
OBJFILES = file.0 file2.0 file3.0
PROGRAM = myprog
$(PROGRAM): $(OBJFILES)
clang -g -Wall -o $(PROGRAM) $(OBJFILES)
clean:
rm $(OBJFILES) $(PROGRAM)
How do you tell a makefile where your header files are located?
clang -I ./include
What are the common causes of errors during linking?