|
-
December 13th, 2004, 06:28 PM
#1
struct - a simple question.
Hi Gurus,
I having a trouble with structure. I am building Printer Port using Windows 2000 DDK (Free Build Enviroment).
When I build the code, it shows the following error:
printTest.c(49) : error C2032: '<Unknown>' : function cannot be member of struct
'_LINEBYTE'
In printTest.c, I have the following structure
------------------------------------------------------------------------------------------------------
....
....
....
typedef struct _LINEBYTE
{
int test;
int myTestFunction();
}LineByte;
....
....
....
-------------------------------------------------------------------------------------------------------
When I compile using Visual C++, it works fine. If I ignore (commented out) this structure, it compile in Visual C++ and Windows 2000 DDK - Free Build Enviroment.
I am just wondering, is the original (old C) structure does not support function? I think I was right, but I just need to confirm it with the GURUs.
Thanks in advance for any help.
Sam
-
December 13th, 2004, 06:33 PM
#2
Re: struct - a simple question.
Functions can only be part of structs in C++, not C. Your file has a *.c extension so vc++ thinks it is a C Source File. Unless you have to program in C (in which case the function cannot be in a struct), then I would just rename the file to printTest.cpp
-
December 13th, 2004, 06:38 PM
#3
Re: struct - a simple question.
Aha... That makes a lot of sense now.
Thanks, Ben...
-
December 14th, 2004, 04:36 AM
#4
Re: struct - a simple question.
Well...the following would have answered your question already... 
-
December 28th, 2004, 07:37 PM
#5
Re: struct - a simple question.
Yes... you are right... Thanks Andreas...
Cheers
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
|