Why am I getting this error C++?
Posted on 2009-12-29
I am using this code below.. I used it in another program and it worked fine... but when I copied it to a new program I get an error
int isRunning(string pName)
unsigned long aProcesses, cbNeeded, cProcesses;
if(!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
cProcesses = cbNeeded / sizeof(unsigned long);
for(unsigned int i = 0; i < cProcesses; i++)
if(aProcesses[i] == 0)
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, aProcesses[i]);
GetModuleBaseName(hProcess, 0, buffer, 50);
The error I get is
error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion)
1> could be 'built-in C++ operator==(char , char )'
The error is for this line
I can probably easily find a solution to fix it.. but I am curious why I could get the error in 1 program and not the other?
I am using the same compiler, and as far as I can tell all the settings are the same for both projects.