2014-05-20 3 views
0

잘하면 간단한 대답으로 간단한 질문입니다. 코드는 C로 작성되었습니다. XC8 컴파일러에서 MPLAB IDE v1.60을 사용하고 있지만 "clock_t"를 인식하지 못합니다. 장치 PIC18F6520에 대해 MPLAB을 설정했습니다. 오류 메시지 빌드하려고하면 다음과 같습니다.clock_t가 MPLAB로 컴파일되지 않음 XC8

ClockTimer.c:16: error: undefined identifier "clock_t" 
ClockTimer.c:16: error: expression syntax 
ClockTimer.c:18: error: expression syntax 
ClockTimer.c:19: error: undefined identifier "stop" 
ClockTimer.c:19: error: undefined identifier "start" 

코드는 다음과 같습니다.

#include <stdio.h> 
#include <stdlib.h> 
#include <xc.h> 
#include <time.h> 


int main() 
{ 
    clock_t start = clock(); 
    // Execuatable code 
    clock_t stop = clock(); 
    double elapsed = (double)(stop - start) * 1000.0/CLOCKS_PER_SEC; 
    printf("Time elapsed in ms: %f", elapsed); 

} 

이것이 컴파일되지 않는 이유는 무엇입니까? clock_t는 긴 부호 단지 별칭이 종종 있기 때문에 감사 마크

+0

컴파일러 설명서를 읽으면 라이브러리가 해당 기능을 단순히 지원하지 않을 수 있습니다. –

답변

0

, 그 IDE가 파일을 찾을 수 없습니다에

unsigned long start = clock();

0

가끔 내가 찾은 문제를 컴파일하려고합니다. 라이브러리에서 파일을 복사하여 프로젝트 폴더에 직접 배치 한 다음 "time.h"로 포함 시키면 문제가 해결됩니다.

희망이 도움이됩니다.