(toppers-etrobo 123) time.h clock()について

東奥航志郎 achioku.koushiro @ ares.eonet.ne.jp
2018年 6月 12日 (火) 00:50:00 JST


開発者様及びメーリングリスト登録者様、いつもお世話になっております。

EV3rtにて、時間経過の判断をしたいと思い、C言語標準ライブラリのtime.hのclock()使用してみたかったのですが、
コンパイル時にエラーが発生し、使用することができませんでした。
EV3rtでは使用できないのでしょうか?
以下、私の書いたプログラムと、コンパイルエラーのログを記します。
もしよろしければご回答お願いいたします。
使用不可の場合は、代替案等ご教授いただけると幸いです…

【開発環境】
macOS High Sierra
EV3rt β7
gcc-arm-none-eabi-6-2017-q1-update

/*******************************************************************************************************************************/
app.c

#include "ev3api.h" 
#include "app.h"
#include <stdio.h>
#include <stdbool.h>
#include <time.h>

#if defined(BUILD_MODULE)
#include "module_cfg.h"
#else
#include "kernel_cfg.h"
#endif

#define DEBUG

#ifdef DEBUG
#define _debug(x) (x)
#else
#define _debug(x)
#endif

char str[20];

clock_t start_point;

void main_task(intptr_t unused)
{
    while(ev3_button_is_pressed (4)==false){
        start_point = clock();
        sprintf(str,"%ld”,start_point);
        ev3_lcd_draw_string(str,0,0);
    }
}

/*******************************************************************************************************************************/

koushiro-MacBook-Air:workspace koushiro$ make app=Kou_timer_test
rm -rf /Users/koushiro/ev3rt/hrp2/sdk/workspace/.././OBJ/
cd /Users/koushiro/ev3rt/hrp2/sdk/workspace/.././OBJ/ && \
	/Users/koushiro/ev3rt/hrp2/sdk/workspace/../../configure -T ev3_gcc -A app \
		-a ../workspace/Kou_timer_test \
		-t ../workspace/Kou_timer_test \
		-D ../.. \
		-L ../common/library \
		-l c \
		-m .ev3rt_temp_Makefile -o "-DBUILD_MODULE" \
		-U "" && \
	rm /Users/koushiro/ev3rt/hrp2/sdk/workspace/Kou_timer_test/.ev3rt_temp_Makefile && \
	mv .ev3rt_temp_Makefile Makefile && \
	make clean
configure: Generating .ev3rt_temp_Makefile from ../workspace/Kou_timer_test/.ev3rt_temp_Makefile.
configure: Generating app.c from ../workspace/Kou_timer_test/app.c.
configure: Generating app.h from ../workspace/Kou_timer_test/app.h.
configure: Generating app.cfg from ../workspace/Kou_timer_test/app.cfg.
rm -f cfg1_out cfg1_out.o cfg1_out.c cfg1_out.syms cfg1_out.srec module_cfg.h module_cfg.c \#* *~ *.o
  CFG[1]  module_cfg.h
  CFG[2]  module_cfg.h
  CC      module_cfg.c
  CC      ../../library/t_perror.c
  CC      ../../library/strerror.c
  CC      ../../library/vasyslog.c
  CC      ../../target/ev3_gcc/TLSF-2.4.6/src/tlsf.c
  CC      app.c
  CC      ../common/ev3api/src/ev3api.c
  CC      ev3api_cfg.c
  CC      ../common/ev3api/src/ev3api_battery.c
  CC      ../common/ev3api/src/ev3api_brick.c
  CC      ../common/ev3api/src/ev3api_fs.c
  CC      ../common/ev3api/src/ev3api_speaker.c
  CC      ../common/ev3api/src/ev3api_lcd.c
  CC      ../common/ev3api/src/ev3api_motor.c
  CC      ../common/ev3api/src/ev3api_newlib.c
  CC      ../common/ev3api/src/ev3api_sensor.c
  LD      app
/usr/local/gcc-arm-none-eabi-6-2017-q1-update/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/libc.a(lib_a-timesr.o): In function `_times_r':
timesr.c:(.text._times_r+0x8): undefined reference to `_times'
collect2: error: ld returned 1 exit status
make[1]: *** [app] Error 1
make: *** [app] Error 2
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
URL: <http://www.toppers.jp/pipermail/etrobo/attachments/20180612/869c5b65/attachment.html>