1023 cd preprocessor # webserver.c is an example of including a .h file 1024 cd webserver_demos 1025 vim list.c 1026 vim list.h 1027 vim webserver.c 1028 gcc -E webserver.c | less 1029 gcc -std=c11 webserver.c # ERROR: missing definitions of list functions 1037 gcc -std=c11 webserver.c list.c # provide compiler the list functions 1038 ./a.out # webserver2.c uses predefined macros 1039 vim webserver2.c 1040 gcc -E webserver2.c | grep LOG 1041 gcc -std=c11 webserver2.c list.c 1042 ./a.out # macro example that can use types as parameters 1045 cd ../parameterized_macros 1046 vim new_macro.c 1046 gcc -E new_macro.c # macro example for writing definitions automatically 1047 vim struct_macro.c 1048 gcc -E struct_macro.c # Below is an example of conditional compilation 1055 cd ../webserver_demos 1056 vim webserver3.c 1057 vim web_utilities.h ## This command shows that the preprocessed webserver3.c will include list.h twice ## slide 15 shows a graph of why. 1060 gcc -E webserver3.c | grep -A3 "typedef struct List" ## Uncomment the header and footer guards in list.h ## Now the command shows the preprocessed webserver3.c includes list.h just once 1062 gcc -E webserver3.c | grep -A3 "typedef struct List" 1066 history > lec16.history