[완료]워닝 좀 잡아주세요~
글쓴이: woiny / 작성시간: 화, 2009/06/30 - 9:51오전
#include <stdio.h>
int main()
{
typedef struct {
int nA;
char cB[10];
int bB;
}stP;
stP arg1, arg2;
stP temp;
arg1.nA = 3;
memcpy(arg1.cB,"hi~!!!!",sizeof("hi~!!!!"));
arg1.bB = 221;
arg2.nA = 7;
memcpy(arg2.cB,"welcome",sizeof("welcome"));
arg2.bB = 77;
memcpy(&temp,&arg1,sizeof(arg1));
printf("result = %d %s %d\n", temp.nA, temp.cB, temp.bB);
memcpy(&arg1, &arg2, sizeof(arg2));
printf("result = %d %s %d\n", arg1.nA, arg1.cB, arg1.bB);
return 1;
}구조체를 복사하는 프로그램을 간단히 짜봤는데요
왜 요걸 gcc로 컴파일하면
17: warning: incompatible implicit declaration of built-in function 'memcpy'
이런 워닝이 뜰까요?
검색해보니 #include 나 #include 를 하라는데 그건 해봐도 아닌거 같네요
Forums:


man 페이지를 보니
man 3 memcpy
string.h 를 include 해주세요.
오..감사합니다.
오..감사합니다.
한방에 해결이네요.ㅋ
역시 여긴 고수들이 많네요~
댓글 달기