compile error ( 'struct' redefinition )
Author Message
compile error ( 'struct' redefinition )

I get this error when compiling my code:

c:\ntddk\src\storage\inc\ntddtape.h(97) : error C2011: '_TAPE_ERASE' :
'struct' type redefinition

included files are:

#include <windows.h>
#include <ntddtape.h>
#include <devioctl.h>
#include <stdio.h>
#include <stdlib.h>

I saw that windef.h also has _TAPE_ERASE defined, but If I only include
windows.h,
then IOCTL_TAPE_SET_POSITION is not defined. how to bypass this problem ?

I'm using MS VS 6 SP 5

Igor

Mon, 07 Jun 2004 02:08:00 GMT
compile error ( 'struct' redefinition )

Quote:
> I get this error when compiling my code:

> c:\ntddk\src\storage\inc\ntddtape.h(97) : error C2011: '_TAPE_ERASE' :
> 'struct' type redefinition

> included files are:

> #include <windows.h>
> #include <ntddtape.h>
> #include <devioctl.h>
> #include <stdio.h>
> #include <stdlib.h>

> I saw that windef.h also has _TAPE_ERASE defined, but If I only include
> windows.h,
> then IOCTL_TAPE_SET_POSITION is not defined. how to bypass this problem ?

> I'm using MS VS 6 SP 5

ok, so now I figured out that the problem is in ntddtape.h. it seams that
there is
a bug (?) in header file...

to bypass this "bug", I've copied ioctl definitons into my code, removed the
"#include <ntddtape.h>" and now it compiles and runs :) fine...

someone should fix ( or at least tell me where I'm wrong ) this.

regards,
Igor

Mon, 07 Jun 2004 02:22:04 GMT
compile error ( 'struct' redefinition )
Igor,
Have you read the relevant MSDN pages
on the functions / definitions you are trying to use?
At the bottom of every page is a requirements
section which states two things:

1. which header file the definitions are located in.
2. which header file you must include

Generally a definition will be located in one header file,
(i.e, _TAPE_ERASE is located in ntddtape.h),
BUT, the docs will state which header file to include -
in almost every case you must include windows.h,
and not explictly include the header file the defs are actually
located in.

I guess you just need to check MSDN carefully
whenever something like this happens..

James.

--
www.catch22.uk.net
Free win32 software, sourcecode, and tutorials
------

Quote:

> > I get this error when compiling my code:

> > c:\ntddk\src\storage\inc\ntddtape.h(97) : error C2011: '_TAPE_ERASE' :
> > 'struct' type redefinition

> > included files are:

> > #include <windows.h>
> > #include <ntddtape.h>
> > #include <devioctl.h>
> > #include <stdio.h>
> > #include <stdlib.h>

> > I saw that windef.h also has _TAPE_ERASE defined, but If I only include
> > windows.h,
> > then IOCTL_TAPE_SET_POSITION is not defined. how to bypass this problem
?

> > I'm using MS VS 6 SP 5

> ok, so now I figured out that the problem is in ntddtape.h. it seams that
> there is
> a bug (?) in header file...

> to bypass this "bug", I've copied ioctl definitons into my code, removed
the
> "#include <ntddtape.h>" and now it compiles and runs :) fine...

> someone should fix ( or at least tell me where I'm wrong ) this.

> regards,
> Igor

Mon, 07 Jun 2004 04:07:33 GMT
compile error ( 'struct' redefinition )

Quote:
> Igor,
> Have you read the relevant MSDN pages
> on the functions / definitions you are trying to use?
> At the bottom of every page is a requirements
> section which states two things:

> 1. which header file the definitions are located in.
> 2. which header file you must include

> Generally a definition will be located in one header file,
> (i.e, _TAPE_ERASE is located in ntddtape.h),
> BUT, the docs will state which header file to include -
> in almost every case you must include windows.h,
> and not explictly include the header file the defs are actually
> located in.

I didn't include defs file, just windows.h ( for various windows-specific
definitons ) and ntddtape.h ( for tape ioctl's )

MSDN from October 2001

from IOCTL_TAPE_SET_POSITION MSDN info:

Defined in ntddtape.h; Include ntddtape.h.

from TAPE_ERASE MSDN info:

Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Header: Declared in Winnt.h; include Windows.h.

now, if I include BOTH windows.h and ntddtape.h the befaviour described
in my first post happens...

Quote:
> I guess you just need to check MSDN carefully
> whenever something like this happens..

first...
I would check such error before posting.

regards,
Igor

Mon, 07 Jun 2004 05:08:29 GMT
compile error ( 'struct' redefinition )
Seems to me that you're trying to mix DDK and SDK functions.
The two structures you mention both have a SDK and a DDK
equivalent

SDK:
TAPE_ERASE
TAPE_SET_POSITION

DDK:
IOCTL_TAPE_ERASE
IOCTL_TAPE_SET_POSITION

Don't mix them. If you're writing a device driver use the DDK
structures, otherwise use the SDK structures

Include windows.h for the SDK versions and ntddtape.h for
the DDK versions

/claes

Quote:

> > I get this error when compiling my code:

> > c:\ntddk\src\storage\inc\ntddtape.h(97) : error C2011: '_TAPE_ERASE' :
> > 'struct' type redefinition

> > included files are:

> > #include <windows.h>
> > #include <ntddtape.h>
> > #include <devioctl.h>
> > #include <stdio.h>
> > #include <stdlib.h>

> > I saw that windef.h also has _TAPE_ERASE defined, but If I only include
> > windows.h,
> > then IOCTL_TAPE_SET_POSITION is not defined. how to bypass this problem
?

> > I'm using MS VS 6 SP 5

> ok, so now I figured out that the problem is in ntddtape.h. it seams that
> there is
> a bug (?) in header file...

> to bypass this "bug", I've copied ioctl definitons into my code, removed
the
> "#include <ntddtape.h>" and now it compiles and runs :) fine...

> someone should fix ( or at least tell me where I'm wrong ) this.

> regards,
> Igor

Mon, 07 Jun 2004 16:54:44 GMT
compile error ( 'struct' redefinition )

Quote:
> Seems to me that you're trying to mix DDK and SDK functions.
> The two structures you mention both have a SDK and a DDK
> equivalent

> SDK:
> TAPE_ERASE
> TAPE_SET_POSITION

> DDK:
> IOCTL_TAPE_ERASE
> IOCTL_TAPE_SET_POSITION

> Don't mix them. If you're writing a device driver use the DDK
> structures, otherwise use the SDK structures

> Include windows.h for the SDK versions and ntddtape.h for
> the DDK versions

yes, that clears few things up for me.
ok, now I can use SDK functions, but how do I send CDB directly to device
using SDK? Now I'm using IOCTL_SCSI_PASS_THROUGH_DIRECT ioctl
and must include ntddscsi.h which is from DDK.

regards,
Igor

Mon, 07 Jun 2004 20:43:56 GMT
compile error ( 'struct' redefinition )
According to KB article Q251369, DeviceIoControl together with
IOCTL_SCSI_PASS_THROUGH_DIRECT is the way to do it.
So I guess you should include ntddscsi.h in this case. Does it
cause any problems?

After studying this a bit more it seems that I was slightly mistaken.
You should be able to mix DDK and SDK headers. However,
I can't check on your original problem since I can't find ntddtape.h!
Maybe my CD is incomplete (October 2000 Edition). I have
ntddscsi.h and bunch of others, but not ntddtape.h?

/claes

Quote:

> > Seems to me that you're trying to mix DDK and SDK functions.
> > The two structures you mention both have a SDK and a DDK
> > equivalent

> > SDK:
> > TAPE_ERASE
> > TAPE_SET_POSITION

> > DDK:
> > IOCTL_TAPE_ERASE
> > IOCTL_TAPE_SET_POSITION

> > Don't mix them. If you're writing a device driver use the DDK
> > structures, otherwise use the SDK structures

> > Include windows.h for the SDK versions and ntddtape.h for
> > the DDK versions

> yes, that clears few things up for me.
> ok, now I can use SDK functions, but how do I send CDB directly to device
> using SDK? Now I'm using IOCTL_SCSI_PASS_THROUGH_DIRECT ioctl
> and must include ntddscsi.h which is from DDK.

> regards,
> Igor

Tue, 08 Jun 2004 17:07:45 GMT
compile error ( 'struct' redefinition )

Quote:
> According to KB article Q251369, DeviceIoControl together with
> IOCTL_SCSI_PASS_THROUGH_DIRECT is the way to do it.
> So I guess you should include ntddscsi.h in this case. Does it
> cause any problems?

this is exactly what I'm doing and it doesn't cause any problems at all...

Quote:
> After studying this a bit more it seems that I was slightly mistaken.
> You should be able to mix DDK and SDK headers. However,
> I can't check on your original problem since I can't find ntddtape.h!
> Maybe my CD is incomplete (October 2000 Edition). I have
> ntddscsi.h and bunch of others, but not ntddtape.h?

it's under /NTDDK/src/storage/inc or something like that.

thx,
Igor

Wed, 09 Jun 2004 01:31:08 GMT

 Page 1 of 1 [ 8 post ]

Relevant Pages