C語言warning C206 missing function-prototype

missing function-prototype

單片機程序,引用DelayMs,

  while (1) {
    //ShellMain();
    printf("hello world\r\n");
    DelayMs(1000);
  }

報錯,

Build target 'Target 1'
compiling main.c...
..\src\main.c(26): warning C206: 'DelayUs': missing function-prototype
..\src\main.c(26): error C267: 'DelayUs': requires ANSI-style prototype
Target not created

明明已經實現了這個函數,後來發現是頭文件的預編譯宏和另外一個文件重複,

#ifndef __PCA_H_
#define __PCA_H_

void DelayUs(unsigned long us);
void DelayMs(unsigned long ms);

#endif

更改爲,

#ifndef __DELAY_H_
#define __DELAY_H_

void DelayUs(unsigned long us);
void DelayMs(unsigned long ms);

#endif
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章