Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
FYI I am using VS2008 and Winddk 7.1 Version in my project.

I create MFC dialog based application.When compiling it is working fine.I Includes some files that uses winddk library and add Winddk library in my projects settings. it gives me error as shown below.

c:\winddk\7600.16385.1\inc\api\ntddstor.h(192) : error C2146: syntax error : missing ';' before identifier 'DeviceType'
c:\winddk\7600.16385.1\inc\api\ntddstor.h(192) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\winddk\7600.16385.1\inc\api\ntddstor.h(192) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int



My Settings are 
c/c++ General
Additional Include Directories :
C:\Program Files\Microsoft Visual Studio 9.0\VC\include;C:\WinDDK\7600.16385.1\inc\api;
linker General
Additional Library Directory:
C:\Program Files\Microsoft Visual Studio 9.0\VC\lib;
Linker input:
Additional Dependencies:
setupapi.lib newdev.lib


I do this in console based application it is working fine.
The reason i found is that it is not recognizing the ntddk.h file and this is due to two include directory.
Any help is appreciated.
Thanks in advance.
Posted
Updated 26-Nov-10 7:53am
v3

I believe you can find this in \7600.16385.1\inc\ddk\wdm.h

#define DEVICE_TYPE ULONG


Best Wishes,
-David Delaune
 
Share this answer
 
Comments
ShilpiP 29-Nov-10 0:45am    
Hi Randor, Thank you sooooooooooo much :)
I was unhappy when i read that ntddk and winnt together creates the problem and i switch to WTL but when you give me hint i checked it once and add wdm.h in my file but receives many error. Than i only #define DEVICE_TYPE in ntddstor and magically it works :))
I dont know it is a good solution but i compile my code without any error.I thought than it is impossible to use MFC with winddk but now it is possible. Thanks again.
+5
The error is probably BEFORE the #include<ntddstor.h>
May be at the end of another file.
Or: ntddstor.h use some typenames that shuld be defined somewhere else before, that you did not include.

Just to experience with this error, try to compile this:
//EXAMPLE a
int a //no ; here
B c;

or
//EXAMPLE B
int a;
B c; //c of type B but B not declared

respect to
//GOOD CASE
typedef int B;
int a;
B c;


And look the compiler error message.
Now imagine the first line to be the last of a "file1.h" and the second to be the first of "file2.h", and to have file.cpp as
#include "file1.h"
#include "file2.h"


Do you got the point?
 
Share this answer
 
Comments
ShilpiP 29-Nov-10 1:08am    
Hi Emilio,
Thanks
Yes the file is wdm.h but when i include this than redefinition error comes in project, because ntddk and winnt together creates the problem. but i find one solution. i dont know it is feasible but i compile my code :).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900