I am new to Visual Studio for C++ (just moved in from Ubuntu g++ / gcc).
I am having trouble since Visual Studio does not seem to recognize
std::vector
, std::complex<>
, std::complex<double>
, etc.
That all worked fine for Linux. How to do incorporate these in Visual Studio?
Asked
Active
Viewed 147 times
-10

Just Shadow
- 10,860
- 6
- 57
- 75

Link L
- 439
- 7
- 25
-
2You do it the same way as in any C++ compiler, you just `#include` the according header. What did you do and what were the errors you got? See also [ask]. – Ulrich Eckhardt Mar 31 '19 at 09:14
-
Assuming, of course, that the IDEs, compilers, and libraries are properly installed and configured. But, if they are not, that's most likely a user problem, not a flaw of particular products. – Peter Mar 31 '19 at 09:16
-
And how did your code look on Linux? – StoryTeller - Unslander Monica Mar 31 '19 at 09:16
-
ok, i just got record time downvotes in a span of 1 minute, apparently i have to include
, – Link L Mar 31 '19 at 09:18, etc. that did not need to be manually specified under the g++ compiler in linux -
2You need to include the header for any library type you use if you want portable code. It's all in a day's work – StoryTeller - Unslander Monica Mar 31 '19 at 09:22
-
*"did not need to be manually specified under the g++"* [Huh?](http://coliru.stacked-crooked.com/a/748f26192bd8d1eb) – HolyBlackCat Mar 31 '19 at 09:23
-
Just include bits/stdc++.h – Black Jack 21 Mar 31 '19 at 09:24
-
2@RedFloyd - [No, no, most definitely not!](https://stackoverflow.com/questions/31816095/why-should-i-not-include-bits-stdc-h). – StoryTeller - Unslander Monica Mar 31 '19 at 09:25
-
@RedFloyd it won't even work for Visual Studio – Aykhan Hagverdili Mar 31 '19 at 09:45
1 Answers
0
You probably copy pasted functions but forgot to include appropriate headers (newbie mistake).
Just try this:
#include <iostream>
#include <vector>
#include <complex>
using namespace std;
int main()
{
cout<<"Hello World";
return 0;
}

Just Shadow
- 10,860
- 6
- 57
- 75
-
1Pardon me but what problem is this answer solving? How is including vector different in visual studio than anywhere else? – Aykhan Hagverdili Mar 31 '19 at 09:45
-
I guess the problem was that he just copy-pasted functions but forgot to include appropriate headers. So this answer just hints that he should include the headers as well. – Just Shadow Mar 31 '19 at 10:18