-
-
Save hidsh/0136eb5b98e3a668b68b3d09277e900e to your computer and use it in GitHub Desktop.
なんか、今日びのgccは個別に -c とかでコンパイルして最後にそいつらをリンクせんでも、1行でソースをコンパイル&リンクしてくれるっぽい
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ls | |
Makefile a.out hogelib.c main.c | |
$ ./a.out | |
2 | |
$ | |
!!!!!!!!!!!!!まじか!!!!!!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int inc(int v) | |
{ | |
return ++v; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
extern int inc(int v); | |
int main(void) | |
{ | |
int x = inc(1); | |
printf("%d\n", x); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a.out: main.c hogelib.c | |
gcc -o $@ $^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a.out: main.o hogelib.o | |
gcc -o $@ $^ | |
main.o: main.c | |
gcc -o $@ -c $< | |
hogelib.o: hogelib.c | |
gcc -o $@ -c $< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
いつから??