arduino库的cpp文件错误

Error in cpp file of an arduino library

本文关键字:错误 文件 cpp 库的 arduino      更新时间:2023-10-16

我正在研究一个项目,其中包括Arduino和指纹扫描仪。它完全基于嵌入式系统。不过,我为指纹扫描仪下载了一个库。当我运行程序时,我得到一个映射到库文件的cpp文件的错误。查看下面的错误和库文件。

误差

FPS_GT511C3 FPS_GT511C3.c.cpp。在函数Command_Packet::GetPacketBytes()': C:UsersDiptiDocumentsArduinolibrariesFPS_GT511C3/FPS_GT511C3.c.cpp:17: undefined reference to中operator new[](unsigned int)'FPS_GT511C3 FPS_GT511C3.c.cpp。在函数FPS_GT511C3::GetResponse()': C:UsersDiptiDocumentsArduinolibrariesFPS_GT511C3/FPS_GT511C3.c.cpp:735: undefined reference to中operator new[](unsigned int)'Collect2.exe: error: ld returned 1 exit status

库文件(CPP)

byte* packetbytes= new byte[12];

byte* resp = new byte[12];

您还没有说明您是如何构建代码的,甚至没有说明您正在使用什么编译器,这使得很难回答。

我猜你没有链接到c++运行时。如果您正在使用GCC,那么您应该使用g++而不是gcc来构建c++代码,以便自动使用c++运行时库。