Skip to content

Instantly share code, notes, and snippets.

@kazzmir
Created February 10, 2018 20:55
Show Gist options
  • Save kazzmir/44cc131b6bd1642e1eede18171849efe to your computer and use it in GitHub Desktop.
Save kazzmir/44cc131b6bd1642e1eede18171849efe to your computer and use it in GitHub Desktop.
xyz.h:
#ifdef XYZ_HEADER
#ifndef XYZ_HEADER_H
#define XYZ_HEADER_H
void xyz_foo();
#endif
#else
#include <stdio.h>
void xyz_foo(){
printf("hello from xyz\n");
}
#endif
x.c:
#define XYZ_HEADER
#include "xyz.h"
int main(){
xyz_foo();
}
$ gcc -x c x.c xyz.h -o x
$ ./x
hello from xyz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment