반응형
경고: 내장 함수 'printf'의 비호환 암묵적 선언 [기본값으로 유효]
다음 C코드를 사용하고 있습니다.
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
int main()
{
int file=0;
if((file=open("testfile.txt",O_RDONLY)) < -1)
return 1;
char buffer[19];
if(read(file,buffer,19) != 19) return 1;
printf("%s\n",buffer);
if(lseek(file,10,SEEK_SET) < 0) return 1;
if(read(file,buffer,19) != 19) return 1;
printf("%s\n",buffer);
return 0;
}
컴파일 후 경고 메시지가 나타납니다.
warning: incompatible implicit declaration of built-in
function ‘printf’ [enabled by default]
C 컴파일러가 경고를 발생시키지 않도록 하려면 어떻게 해야 합니까?
를 추가해야 합니다.#include <stdio.h>파일 맨 위로 이동합니다.
언급URL : https://stackoverflow.com/questions/20041100/warning-incompatible-implicit-declaration-of-built-in-function-printf-enable
반응형
'programing' 카테고리의 다른 글
| VueJ에서 Vuex 액션이 디스패치되었는지 유닛 테스트하는 방법s (0) | 2022.07.23 |
|---|---|
| 조작 가능한 편집이 Vuex 변환 오류를 트리거합니다. (0) | 2022.07.23 |
| Keystore 비밀번호 변경 (0) | 2022.07.23 |
| 기존 이클립스 프로젝트를 메이븐 프로젝트로 변환 (0) | 2022.07.22 |
| Java InputStream의 콘텐츠를 OutputStream에 쉽게 쓰는 방법 (0) | 2022.07.21 |