As this is C++ main must have a return type in it's declaration. The actual error that you are getting seems to indicate that you need to #include <sstream> at some point.
While you can declare a variable inside an if's condition expression it's not a feature that's used very often and the one object that's constructed must have an valid implicit conversion sequence to a bool. You can't use a , to attempt to declare two variables, it's not a valid expression for an if clause.
If construction of any object fails then an exception will have to have been thrown so this isn't a necessary or correct way to test for construction failure. You should probably just declare your variables in the function scope of main.