1

ArduinoとXbee Zgを使用してローカリゼーションプロジェクトを作成し、84 Mhzクロックarduino 1.5.2 IDEを備えたarduino dueボードを使用して、ナノ秒の解像度で時間を測定する必要があります

clock_gettime関数 を使用しようとすると、すでに time.h が含まれていますが、同じコンパイルエラー clock_gettime が発生しますが、このスコープでは宣言されていません

これは私の Distance_Measurement.c ファイルの一部です

#include "Distance_Measurement.h"
#include "time.h"
struct timespec start, stop;

bool Start_Time()
{
 if(clock_gettime(CLOCK_REALTIME,&start) == -1)
    return false;
 else 
    return true;
}

bool Stop_Time()
{
  if(clock_gettime(CLOCK_REALTIME,&stop) == -1)
    return false;
  else 
    return true;
}

double Cal_Time_Nano()
{ 
    return (stop_time.tv_nsec - start_time.tv_nsec);
}

私を助けてください

4

1 に答える 1

0

私は最初に #include を使用しました。同じエラーが発生しました。Visual Studio が arduino gcc に time.h ではなく anther time.h を含めていることがわかったので、最後のものをコピーして、距離測定ライブラリである arduino ライブラリ パスに貼り付けました – PrinceOfEgy

于 2016-11-17T13:11:25.533 に答える