Hello everyone! I am having a bit of an odd problem here.
So, on my Visual Studio project, I decided to use a precompiled header. This didn't seem to cause a noticable problem up until today.

I have a small segment of code that is supposed to remove one element of a vector based on it's contents:

using namespace std;
. . .
vector<int> v;
v.erase(std::remove(v.begin(), v.end(), 6), v.end()); 

This USUALLY works. However, Visual Studio kept griping at me about how the synax is incorrect. So, I right-clicked on the remove function and found it's definition inside stdio.h:

_CRTIMP int __cdecl remove(_In_z_ const char * _Filename);

Hmm. Go figure. That seems to be a different remove function all together! This has stunted my progress, as I can't seem to find any help online for this.

Does anyone know how to fix this issue? Am I making a noob mistake?

I would greatly appreciate any comments.

Edited 4 Years Ago by Hazardous_Byte

Did you include the header <algorithm>? Normally, this should be resolved by overloading. And you might also want to remove the using namespace std; statement. This remove function that you are getting is this one from cstdio. If you include the <algorithm> header, the overload resolution should be able to find the correct remove function.

This question has already been answered. Start a new discussion instead.