Issues with 'StandardCplusplus' Library in Arduino

左心房为你撑大大i 提交于 2019-12-13 19:24:43

问题


I had to write some code for Arduino in C++. The code works perfectly, but wouldn't work in Arduino as I had used some libraries like vectors, ifstream, etc.

So I included the StandardCplusplus library. I downloaded the zip version of the library.

I copied the extracted version into the library folder of Arduino. Now the vector library works, i.e. it doesn't give any compile error.

But on #include fstream, Arduino gives the following error: fatal error: unistd.h: No such file or directory


回答1:


A bit late, but maybe someone else encounters the same problem, just like me looking for an answer couple of minutes ago. I turned the problem from an error to a warning by defining a symbol ARDUINO (I use eclipse, so I added a new symbol in the project's Properties --> C/C++ Build --> Settings --> AVR Compiler / AVR C++ Compiler --> Symbols. Don't know what you're using, but you could add -DARDUINO when calling avr-g++). The problem is in ios.cpp file, where you have: #ifdef ARDUINO #include <HardwareSerial.h> #include <serstream> #else #include <fstream> #endif As soon as the ARDUINO symbol is seen in the ios.cpp file, two earlier includes are taken instead of the fstream.



来源:https://stackoverflow.com/questions/31921314/issues-with-standardcplusplus-library-in-arduino

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!