Your GetTextureGroupName()
function is of a std::string type. The std::strstr() function does not accept a std::string
as a parameter. Use the string c_str() member function instead:
if (std::strstr(pMaterial->GetTextureGroupName().c_str(), "World textures")){
pMaterial->ColorModulate(0.5, 0.5, 0.5);
}
Rather than falling back to C style strings you should explore the std::string
facilities as pointed out in the comments. The modified example uses the std::string::find member function:
if (pMaterial->GetTextureGroupName().find("World textures")!= std::string::npos){
pMaterial->ColorModulate(0.5, 0.5, 0.5);
}
1
solved C++ weird error strstr [closed]