So I have code like
int main(int argc, char* argv[])
{
string outputUrl ;
string outputContainer ;
string outputUserName ;
for(int i = 0 i>=argc; i+2){
switch(argv[i]){ //C2450
case "-server" : {outputUrl += (argv[i+1]);} break; //C2051
case "-container" : {outputContainer = (argv[i+1]);} break; //C2051
case "-nickname" : {outputUserName += (argv[i+1]);} break; //C2051
}
}
Why does it give me compiler error C2450 and on next line C2051?
How to fix such thing?
The
switchstatement can’t use strings. You’ll need to replace it with a string ofif–else ifstatements instead.