16

I just encountered a weird error which saying that find is not a member of std.

error C2039: 'find' : is not a member of 'std'

error C3861: 'find': identifier not found

Basically, I want to find whether a string can be found in the vector

Any idea why does this happen? the code assist tells me that there is find method in std.

so this is basically what I did :

#include "OperatorUtil.h"
#include <iostream>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <sstream>


using namespace saeConfig;


namespace operatorUtil
{
   bool isIn(const Filter filter, const SearchKey key)
   {
    
    bool result = false;

    
    string dimensionStr = key.dimensions.getValue(filter.getFilterKey());
    if(filter.getFilterValues().size()>0)
    {
        vector<string> vstr= filter.getFilterValues();
        std::vector<string>::iterator it;        // Iterator
        it = std::find(vstr.begin(), vstr.end(), dimensionStr);  //ERROR LINE  
        // Check do we have the object in the queue
        if(it == vstr.end())    
        {           
            result =true;
        }
    }

    return result;
   }
}
Community
  • 1
  • 1
Rudy
  • 7,008
  • 12
  • 50
  • 85
  • Have you tried any googling? Also, this code sample is not compilable, because I didn't have rest of your code. For the future try to post http://sscce.org code samples - it is much easier to give the correct answer. – Rafał Rawicki Mar 26 '12 at 07:19

1 Answers1

41

std::find is defined in the <algorithm> header. Add to the beginning:

#include <algorithm>
Rafał Rawicki
  • 22,324
  • 5
  • 59
  • 79