Calling `clock()` gives an error: undefined reference to `_times'
Calling `clock()` gives an error: undefined reference to `_times'
我试图在我的 C++ 代码中使用 clock()
函数,但它不起作用。我试过添加 #include <time.h>
或 #include <ctime>
但没有用。我正在使用 Atmel Studio。
#include <time.h>
int main(void)
{
clock_t myClock = clock();
}
应该没有错误,但我收到以下错误消息:
recipe for target 'SAMS70.elf' failed
undefined reference to `_times'
ld returned 1 exit status
有人知道为什么会这样吗?
MCU 通常不会公开处理器使用时间。库 clock
函数调用预期的 _times
函数来获取值,但由于上述原因未为 MCU 定义该函数。
我试图在我的 C++ 代码中使用 clock()
函数,但它不起作用。我试过添加 #include <time.h>
或 #include <ctime>
但没有用。我正在使用 Atmel Studio。
#include <time.h>
int main(void)
{
clock_t myClock = clock();
}
应该没有错误,但我收到以下错误消息:
recipe for target 'SAMS70.elf' failed
undefined reference to `_times'
ld returned 1 exit status
有人知道为什么会这样吗?
MCU 通常不会公开处理器使用时间。库 clock
函数调用预期的 _times
函数来获取值,但由于上述原因未为 MCU 定义该函数。