当我mbed-os
和我自己的库并排安装时,我收到以下错误消息
文件夹布局:
.
|_mbed-os
|_library
/mbed-os/platform/Callback.h:21:15: fatal error: new: No such file or directory
compilation terminated.
源自以下行:
#include <new>
包含此文件:
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file timer_platform.h
*/
#include "mbed.h"
#include "timer_interface.h"
/**
* definition of the Timer struct. Platform specific
*/
struct Timer Timer;
#ifdef __cplusplus
}
#endif
运行mbed compile
我在1.0.0版本中使用mbed-cli运行Windows 10 64位。编译器是gcc-arm-none-eabi 5.4
这个图书馆应该放在哪里?如何跟踪错误?我对C ++很陌生,但确实有一些C
的经验答案 0 :(得分:2)
我认为这是因为您从.c文件引用了mbed.h
标头(或Callback.h
)。重命名为C ++。
如果您需要将文件设置为C,请将其包装在extern "C" {}
块中。