Procedure that returns list<MyClass> cannot compile
Oct 25, 2010 at 4:58am UTC
Hello all,
I have a class called MyClass defined in C++. And I have a procedure that wants to return a list with MyClass objects.
I have the procedure declared on top of my code as:
1 2 3 4 5 6 7 8
static list<MyClass> MyProcedure(char *, int );
//then defined:
static list<MyClass> MyProcedure(char *searchstr, int pos)
{
}
But, when I compile I get the following errors:
1.error C4430: missing type specifier - int assumed.
2.error C3861: 'MyProcedure': identifier not found
3. error C2447: '{' : missing function header (old-style formal list?)
... and seven more.
What am I doing wrong?
Thanks!
Oct 25, 2010 at 5:07am UTC
static
? I don't think you can have that on a global function.
Oct 25, 2010 at 5:09am UTC
Is it better if I return a pointer to my objects?
Oct 25, 2010 at 5:10am UTC
Even with a removed static
the errors are the same.
Oct 25, 2010 at 5:14am UTC
Have you tried std::list?
Just in case, please list all 10 or so errors.
Oct 25, 2010 at 5:27am UTC
Thanks, std::list solved the issue! =]
Topic archived. No new replies allowed.