Skip to content

Instantly share code, notes, and snippets.

@flaneur2020
Created December 8, 2012 03:53
Show Gist options
  • Save flaneur2020/4238509 to your computer and use it in GitHub Desktop.
Save flaneur2020/4238509 to your computer and use it in GitHub Desktop.
inline.c
#include <stdio.h>
inline void i_hello() {
printf("hello\n");
}
static inline void si_hello() {
printf("static inline hello\n");
}
extern inline void ei_hello() {
printf("static inline hello\n");
}
int main(int argc, char *argv[]) {
i_hello();
si_hello();
ei_hello();
return 0;
}
/*
$ clang inline.c
/tmp/cc-uA9XPc.o: In function `main':
inline.c:(.text+0x48): undefined reference to `i_hello'
collect2: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see
invocation)
*/
/*
$ gcc inline.c
/tmp/ccDgCZat.o: In function `main':
inline.c:(.text+0x39): undefined reference to `ei_hello'
collect2: ld returned 1 exit status
* */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment