In my C++ project std::remove refers to stdio.h

I have error in my code:
1
2
void Config::UpdateMRUPageClose(const wxString &path) {
    mru.erase(std::remove(mru.begin(), mru.end(), path), mru.end());

/home/andrzej/gitmy/scintas/src/Config.cpp:37:36: error: cannot convert ‘std::vector<wxString>::iterator’ {aka ‘__gnu_cxx::__normal_iterator<wxString*, std::vector<wxString> >’} to ‘const char*’

CLion say that std::remove refer to
extern int remove (const char *__filename) __THROW;
in stdio.h

I think, one posiiblity this error is
1
2
3
namespace std {
  include <stdio.h>
}

but I can't find this, only "using namespace std"
std::remove is in the <algorithm> library for C++ as well in the <cstdio>/<stdio.h> library.
https://en.cppreference.com/w/cpp/algorithm/remove
https://en.cppreference.com/w/cpp/io/c/remove

Did you include <algorithm>? Did you include <cstdio>/<stdio.h>?

It appears CLion selected the C function when you wanted the C++ function. This confusion could be a consequence of having using namespace std; in your code, the compiler is getting confused as to what remove() function is to be used.
Registered users can post here. Sign in or register to post.