Reputation: 20644
I have a simple method:
std::vector<string> start()
{
std::vector<std::string> deletedFiles; // << error appeared at this declaration
}
Error: Unable to create variable object
What is wrong here?
Thanks in advance.
Upvotes: 2
Views: 10092
Reputation: 68033
Maybe you've missed a namespace prefix...
std::vector<string> start()
Should it be this?
std::vector<std::string> start()
Upvotes: 0
Reputation: 22089
This similar program compiles without a hitch:
#include <vector>
#include <string>
std::vector<std::string> start()
{
std::vector<std::string> deletedFiles;
return deletedFiles;
}
int main()
{
std::vector<std::string> deletedFiles = start();
return 0;
}
Please double check your #include
s and your std::
s. You might want to add std::
to string
in your return type.
Upvotes: 4
Reputation: 179799
Nothing, really. The error will be somewhere else. For instance, there's a missing return statement in the function, and you're missing #include
's, but that's probably code you snipped.
Upvotes: 0