如果我在代码中使用std::find ,我的项目将无法构建。我得到的错误如下
usr/include/c++/4.6/bits/stl_algo.h:162:4:错误:'_ first中的'operator=='不匹配。_gnu_cxx::__normal_iterator<_Iterator, _Container>::operator* with _Iterator = char*, _Container = std::basic_string, __gnu_cxx::__normal_iterator<_Iterator, _Container>::reference = char& == __val' /usr/include/c++ /4.6/bits/stl_algo.h:162:4:注意:候选人是:
下面是我的代码..
std::string lValueCmd = "";
std::string lModeType = "";
std::string lAPModeCmd = "sudo iwconfig /sbin/wlan0 | grep -i 'Mode:' | awk '{print $1}'";
// function to retrive values from linux command and store it in lValueCmd
lResult = RequestCmdOutput( lAPModeCmd, lValueCmd ) ; // function to retrive values from linux command and store it in lValue Cmdd
// std::cout << " the string is " << lValueCmd << std::endl;// debug
std::string delimiter= ":";
std::string::iterator pos;
pos= std::find( lValueCmd.begin(), lValueCmd.end(), delimiter); // no error if I comment this line.
我使用的头文件是 iostream 、 algorithm 和 string 。