Posts
Q&A
์ด ๊ฐ์์ ๋ํ ์ง๋ฌธ์ ์๋๋ฐ ๊ถ๊ธํ๊ฑฐ ํ๋ ์ง๋ฌธ๋๋ฆฝ๋๋ค
๋น ๋ฅด๊ณ ์ ํํ ๋ต๋ณ ๊ฐ์ฌํฉ๋๋ค!
- 1
- 2
- 197
Q&A
my_functions.h ํ์ผ ์ง๋ฌธ์ ๋๋ค
๊ฐ์ฌํฉ๋๋ค!! ์ดํด๋์์ด์ ใ ใ
- 0
- 7
- 537
Q&A
my_functions.h ํ์ผ ์ง๋ฌธ์ ๋๋ค
(์ฌ์ง) ์ด๊ฑด ์๋ฌ๋ฉ์์ง์ ๋๋น,,ใ
- 0
- 7
- 537
Q&A
my_functions.h ํ์ผ ์ง๋ฌธ์ ๋๋ค
-main.c- #define _CRT_SECURE_NO_WARNINGS #include #include "my_functions.h" #include "my_structures.h" #include "my_macros.h" extern int status; int main() { #include "hello_world.h" printf("PI = %f\n", PI); printf("%p %d\n", &status, status); print_status(); printf("%d\n", multiply(51, 2)); printf("main()\n"); printf("Static function address %p\n", multiply); printf("Static variable address %p\n", &si); print_address(); return 0; }- my_function.h - #pragma once #include "my_functions.h" extern int status; int si = 0; extern int add(int a, int b); int multiply(int a, int b) { return a * b; } // int subtract(int a, int b) inline int subtract(int a, int b) { return a - b; } void print_status(); void print_address(); -my_function.c- #include "my_functions.h" #include int status = 0; int add(int a, int b) { return a + b; } void print_status() { printf("Address = %p, Value = %d\n", &status, status); } void print_address() { printf("print_address()\n"); printf("Static function address %p\n", multiply); printf("Static variable address %p\n", &si); }์ด๋ ๊ฒ ๊ต์๋์ด๋ static ๋บด๊ณค ๋ค ๋์ผํฉ๋๋ค ใ ใ ์์ด๋ฐ์ง๋ชจ๋ฅด๊ฒ ๋ค์,,
- 0
- 7
- 537
Q&A
my_functions.h ํ์ผ ์ง๋ฌธ์ ๋๋ค
my_function.h์ ์๋ int multiply์ int si์์ static์ ๋ผ๋๊น _multiply already defined in main.obj _si already defined in main.obj one or more multiply defined symbols found ๋ผ๊ณ ๋งํน์๋ฌ ๋จ๋๋ฐ ์์ด๋ฐ์ง ๋ชจ๋ฅด๊ฒ ๋ค์ ใ ใ static ๋ผ๋ ์ ๋น๋๋์๋์?
- 0
- 7
- 537