|
-
December 16th, 2009, 05:19 AM
#1
Beginner's problem
Hi
Not sure if I should ask my question here, so admin please move it to the appropriate section. Sorry for the trouble.
I'm coding using VS6. I wanted to create a method that will return a user-defined struct.
This is found in the header file.
class A
{
protected :
typedef struct {
int a;
int b;
} B;
B NAHD_Match::ABC(const char *name1);
}
It compiles fine if I don't use the method ABC in the source code.
However, when I try to insert code for
A::ABC(const char *name1)
in the source code to the following
B A::ABC(){
B newB;
newB.a=99;
newB.b=45;
return newB;
}
the compiler pops the following error message.
D:\Shared Documents\Work Docs\A.cpp(72) : error C2143: syntax error : missing ';' before 'tag::id'
D:\Shared Documents\Work Docs\A.cpp(72) : error C2501: 'B' : missing storage-class or type specifiers
D:\Shared Documents\Work Docs\A.cpp(72) : fatal error C1004: unexpected end of file found
palmprintDlg.cpp
And when I change the return type to int, the code will compile successfully. The actual full code isn't written by me and I was task to check some of the implementations only so I would try not to include the entire code here unless really needed.
The include message if needed, contains
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "A.h"
Do let me know where did I do wrong?
Thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|