Problems with Vectors in Microsoft C++

Pages: 12
I just discovered that the problem may be something totally different than it appears. The following code compiles and works just fine but Intellisense tells me that v1(10) is not valid and that v1.size() is not legal, stating that they are both unknown constructors.

I guess I must now pursue why my Intellisense is broken.

#include <iostream>
#include <vector>
using namespace std;

int main()
{
vector<int> v1(10);
int x = v1.size();
}
closed account (E0p9LyTq)
Your Visual Studio installation probably needs to be repaired.

Open up the Visual Studio Installer. Next to the Modify and Launch buttons there is a More pulldown menu. Select repair.

There could also be extension conflicts. If you have any recent extension(s) try disabling it/them and see if the intellisense issue clears up.

That happened to me before.
Last edited on
Fixed my problem by deleting the .suo file in the Solution folder. Apparently this file is used for Intellisense caching. Deleting it seems to have resolved the problem. Sorry for leading everyone down a rabbit hole.

riversr54
closed account (E0p9LyTq)
It happens. Now you know what looks like one problem can be something entirely else.

Please green check this as solved. :)
Last edited on
Topic archived. No new replies allowed.
Pages: 12