1

I'm trying to compile an Arduino lib I'm writing under Eclipse. This is the basic sketch sx.cpp I'm using, it compiles using standard Arduino IDE 1.8.0:

#include <Arduino.h>
#include <vector>

void setup() {

}

void loop() {

 std::vector<byte> a(0x22);
}

This is the compiler out:

Building sx
"C:/Users/Ale/Documents/Arduino/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10608 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   -I"C:/Users/Ale/Documents/Arduino/packages/arduino/hardware/avr/1.6.21/cores/arduino" -I"C:/Users/Ale/Documents/Arduino/packages/arduino/hardware/avr/1.6.21/variants/standard" "../../sx.cpp" -o "project/sx.cpp.o"
../../sx.cpp:3:18: fatal error: vector: No such file or directory
 #include <vector>
                  ^
compilation terminated.
make: *** [project/sx.cpp.o] Error 1
makefile:67: recipe for target 'project/sx.cpp.o' failed

I'm using Eclipse 4.8.0 and Arduino project nature (CDT core compiler), but I'm not interested in uploading to real boards and/or debugging. Without vector a and relevant #include of course it compiles.

(EDIT) The longer story:

I have been writing this lib for like 5 days with text editors. I come from Java development, so please be patient. My lib uses some c++ standard classes, std::vector among a couple other. Everything was OK using Arduino IDE, but after 5 days it's way unpractical for me, so I decided to re-try Arduino with Eclipse after 5 years (my first eclipse-cdt experience was awful and complex). With newest Photon release, I noticed the 'Arduino' template project and the Arduino lib manager included "out-of-the-box", so I decided to give it a try.

I'm actually using an ESP32 board but again, I'm not interested in uploading/executing the code. I just need to be able to refactor it handly

Shine
  • 3,788
  • 1
  • 36
  • 59
  • 1
    Possible duplicate of [Vectors in Arduino](https://stackoverflow.com/questions/9986591/vectors-in-arduino) – Jacob Boertjes Jul 03 '18 at 16:01
  • I don't think it's duplicate, my sketch works if I compile it with standard Arduino IDE – Shine Jul 03 '18 at 16:04
  • Did you install whatever STL package you're using under Eclipse? – Ignacio Vazquez-Abrams Jul 03 '18 at 16:08
  • I guess not, @Ignacio. Would you elaborate an answer please? – Shine Jul 03 '18 at 16:10
  • Hi. First you need to go to help->arduino manager and instal esp platform, you are probably using the base compiler (avr atmel 16) and it does not have stl built in. After you installled you need to create new launch configuration and tell it to use your esp package. I belive the icons are on the top right of the screen. – codeScriber Aug 21 '18 at 05:37

0 Answers0