queezythegreat / arduino-cmake

Arduino CMake Build system
645 stars 216 forks source link

<iostream> not found when compiling project #176

Open anna-seppala opened 6 years ago

anna-seppala commented 6 years ago

Hello all, I recently stumbled upon this project when looking for ways to use cmake with Arduino. I am reusing the examples within the project, and wanted to expand blink.cpp by using . Only adding the include into blink.cpp makes the compilation fail. cmake is unable to find the library and terminates compilation. I fail to understand why. Could anyone enlighten me?

JonasProgrammer commented 6 years ago

Hello Anna, you seem to misunderstand what Arduino CMake actually is and what it isn't. Let me explain: Arduino CMake is just a build system to give you more freedom in structure and options especially for bigger projects. But it still uses the very same compiler and libraries Arduino itself provides (avr-gcc and the default Arduino libraries). So while you can compile and link additional libraries with CMake, it still does not provide fully-fledged C++ standard library (which iostream belongs to*).

To answer your question, if you want to interact with a user, you could just use the Serial library and connect to the virtual serial terminal on PC. Please do note however, that this is by far simpler than the C++ stream libraries.

Although it's been 2 months, I hope I still could help a little.