I am trying to compile my driver for x64 Win7. It compiles fine under x86. But when I open the build environment Win7 x64 I get a header error in
crtdefs.h (457). The error is
error C2371: ‘size_t’ : redefinition…
when I run oacr log root:amd64chk it shows
#ifdef _WIN64
typedef __int64 size_t
I have tried searching the OSR forums and found several people that have experienced the problem, but I can’t seem to find an applicable solution.
Someone said that they didn’t have the full DDK installed, another that WinXP64 was the same as W2K3. Does anyone have any ideas? Thanks.
Michael Wade wrote:
I am trying to compile my driver for x64 Win7. It compiles fine under x86. But when I open the build environment Win7 x64 I get a header error in
crtdefs.h (457). The error is
error C2371: ‘size_t’ : redefinition…
when I run oacr log root:amd64chk it shows
#ifdef _WIN64
typedef __int64 size_t
I have tried searching the OSR forums and found several people that have experienced the problem, but I can’t seem to find an applicable solution.
Can you show us the sequence of #include lines at the start of your
driver? If the lines are in the right order, this should not be a problem.
Someone said that they didn’t have the full DDK installed, another that WinXP64 was the same as W2K3. Does anyone have any ideas?
The first is irrelevant, the second is true but also irrelevant.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Sure, Tim, and thanks!
The source file (only one) has this include sequence:
#include <ntddk.h>
#include <ntstrsafe.h>
#include “TapDrv.h”
Then in TapDrv.h I have this:
extern “C” {
#include <ntddk.h>
#include <wdf.h>
}
I think thats it
Thanks,
Michael
On Mon, 10 Jan 2011 10:24:37 -0800, Tim Roberts wrote:
>Michael Wade wrote:
>> I am trying to compile my driver for x64 Win7. It compiles fine under x86. But when I open the build environment Win7 x64 I get a header error in
>> crtdefs.h (457). The error is
>> error C2371: ‘size_t’ : redefinition…
>> when I run oacr log root:amd64chk it shows
>> #ifdef _WIN64
>> typedef __int64 size_t
>>
>> I have tried searching the OSR forums and found several people that have experienced the problem, but I can’t seem to find an applicable solution.
>
>Can you show us the sequence of #include lines at the start of your
>driver? If the lines are in the right order, this should not be a problem.
>
>> Someone said that they didn’t have the full DDK installed, another that WinXP64 was the same as W2K3. Does anyone have any ideas?
>
>The first is irrelevant, the second is true but also irrelevant.</wdf.h></ntddk.h></ntstrsafe.h></ntddk.h>
Perfect! Thanks Tim!
Yes, this is a KMDF driver (my first, obviously)
On Mon, 10 Jan 2011 10:47:33 -0800, Tim Roberts wrote:
>Michael Wade wrote:
>> Sure, Tim, and thanks!
>> The source file (only one) has this include sequence:
>> #include <ntddk.h>
>> #include <ntstrsafe.h>
>>
>>
>> #include “TapDrv.h”
>>
>>
>> Then in TapDrv.h I have this:
>>
>> extern “C” {
>> #include <ntddk.h>
>> #include <wdf.h>
>> }
>
>The problem is the extern “C” declaration. The typedef within extern
>“C” is seen as a different type than the one without. You certainly do
>not need extern “C” around <wdf.h> – that file is already C+±safe. In
>fact, in the latest WDK, even <ntddk.h> is C+±safe, so you should be
>able to eliminate the extern “C” completely.
>
>However, philosophically, there is a problem here. If the source file
>is TapDrv.cpp, then by the time you get to TapDrv.h, you have already
>included <ntddk.h> without the extern “C”. You should decide whether
>your includes happen in the .h file or in the .cpp file.
>
>Is this a KMDF driver?</ntddk.h></ntddk.h></wdf.h></wdf.h></ntddk.h></ntstrsafe.h></ntddk.h>