Solved

fatal error: vector: No such file or directory   Visual Studio 2015 for Arduino

Posted on 2016-11-05
4
32 Views
Last Modified: 2016-11-07
Visual Studio 2015 for Arduino C++.  

My first program gives "fatal error: vector: No such file or directory".  Tried various option from web such as vector.h etc.

#include <vector>
using std::vector;

void setup() {
      Serial.begin(9600);
}

void loop() {
      std::vector<int> newvector;
      Serial.println("Hi");
      delay(100);
}
0
Comment
Question by:John Lucas
  • 2
4 Comments
 

Author Comment

by:John Lucas
Comment Utility
Or, to put it another way that I think is related, I can put:

String xx = "";

in the .ino file but not in a .cpp file!

I'm assuming some library or reference is needed.

I get these same problems with Eclipse (Arduino version) and Visual Studio for Arduino!!!
0
 
LVL 28

Accepted Solution

by:
pepr earned 250 total points
Comment Utility
I do not actively use Arduino. However, it seems that its language is not the C++ language. It is only a subset that uses the same syntax. (Correct me if I am wrong.) And the subset does not have the Standard C++ Library. And there may be good reasons for that.

The implementation of the C++ Standard Library is always directly bound to the compiler and possibly to the hardware target. The reasons are that the implementation should be as efficient as possible for the hardware

It is clear that there are more people like you who are used to C++ and would like to have the std:: functionality. Therefore, you should search for a third party implementation -- like here:

https://github.com/maniacbug/StandardCplusplus

This is just the first thing that I have found. You may want to search further.
0
 
LVL 32

Assisted Solution

by:sarabande
sarabande earned 250 total points
Comment Utility
to add to above: there are a few ports of STL that could be used. for example check

http://andybrown.me.uk/2011/01/15/the-standard-template-library-stl-for-avr-with-c-streams/

Sara
0
 

Author Comment

by:John Lucas
Comment Utility
Thanks about the library  In my ignorance i did not realise the Arduino was different from standard.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now