Advertisement
Paszta

Systemy - gcc/mf od podroznika

May 6th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.71 KB | None | 0 0
  1. hello.h:
  2. #ifndef hello_h
  3. #define hello_h
  4. void hello(int i, double n);
  5. #endif
  6.  
  7. hello.c:
  8. #include <stdio.h>
  9. #include "hw_hello.h"
  10. void hello(int i, double n) {
  11.     printf("Hello, world !!! \n");
  12.     const char *s = "Jak tekst";
  13.     printf("I wynosi: %i n wymosi:  %.2f tekst: %s\n",i,n,s);
  14. }
  15.  
  16. main.c:
  17. #include"hw_hello.h"
  18. int main() {
  19.     hello(11,13.03123);
  20.     return 0;
  21. }
  22.  
  23. WYWOLANIE W TERMINALU: gcc -o hello hello.c main.c hello.h
  24.  
  25. makefile:
  26. .PHONY: clean
  27. all: hello
  28. hello: hw_main.o hw_hello.o
  29.     gcc hw_main.o hw_hello.o -o hello
  30. hw_hello.o: hw_hello.c
  31.     gcc -c hw_hello.c -o hw_hello.o
  32. hw_main.o: hw_main.c
  33.     gcc -c hw_main.c -o hw_main.o
  34. clean:
  35.     rm -f *.o *.a *.so hello
  36.  
  37. WYWOLANIE W TERMINALU: make
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement