First driver - compilation help

Hi,

I am working my way through my first driver and was using OSR and the
following Microsoft article:
http://msdn.microsoft.com/en-us/library/windows/hardware/hh439665(v=vs.85).aspx

My code is copy and pasted from the article.

Error 1 error C2065: ‘KmdfSmallEvtDeviceAdd’ : undeclared identifier
c:\HelloWorld\HelloWorld\Driver.c 14 1 HelloWorld
Warning 2 warning C4047: ‘function’ : ‘PFN_WDF_DRIVER_DEVICE_ADD’ differs
in levels of indirection from ‘int’ c:\HelloWorld\HelloWorld\Driver.c 14 1
HelloWorld
Warning 3 warning C4024: ‘WDF_DRIVER_CONFIG_INIT’ : different types for
formal and actual parameter 2 c:\HelloWorld\HelloWorld\Driver.c 14 1
HelloWorld
Error 4 error MSB3030: Could not copy the file
“c:\HelloWorld\x64\Win7Debug\HelloWorld.sys” because it was not found.
C:\Program
Files (x86)\Windows Kits\8.1\build\WindowsDriver.common.targets 1366 5
HelloWorld
Package
5 IntelliSense: identifier “KmdfSmallEvtDeviceAdd” is undefined
c:\HelloWorld\HelloWorld\Driver.c 14 34 HelloWorld

I think the main issue is the undeclared identifier, which I would imagine
is because I’m missing a library; however, I have not been able to find
what library to include.

My system is Win7 64-bit.

Thanks in advance!

J. Brett Cunningham

Hmmmm… the compiler is telling you that you have not defined (or, provided a forward definition for) the function named “KmdfSmallEvtDeviceAdd”… This is a function that YOU would have to write in your code, that will be called when a device of the type supported by your driver is discovered (or, the equivalent for a “software only” driver).

Peter
OSR
@OSRDrivers

From the sample did you change:

EVT_WDF_DRIVER_DEVICE_ADD KmdfHelloWorldEvtDeviceAdd;

To

EVT_WDF_DRIVER_DEVICE_ADD KmdfSmallEvtDeviceAdd;

It looks like to me that you are missing the definition.

Don Burn

Windows Filesystem and Driver Consulting

Website: http:</http:> http://www.windrvr.com

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Brett Cunningham
Sent: Wednesday, September 03, 2014 4:37 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] First driver - compilation help

Hi,

I am working my way through my first driver and was using OSR and the following Microsoft article: http://msdn.microsoft.com/en-us/library/windows/hardware/hh439665(v=vs.85).aspx

My code is copy and pasted from the article.

Error 1 error C2065: ‘KmdfSmallEvtDeviceAdd’ : undeclared identifier c:\HelloWorld\HelloWorld\Driver.c 14 1 HelloWorld

Warning 2 warning C4047: ‘function’ : ‘PFN_WDF_DRIVER_DEVICE_ADD’ differs in levels of indirection from ‘int’ c:\HelloWorld\HelloWorld\Driver.c 14 1 HelloWorld

Warning 3 warning C4024: ‘WDF_DRIVER_CONFIG_INIT’ : different types for formal and actual parameter 2 c:\HelloWorld\HelloWorld\Driver.c 14 1 HelloWorld

Error 4 error MSB3030: Could not copy the file “c:\HelloWorld\x64\Win7Debug\HelloWorld.sys” because it was not found. C:\Program Files (x86)\Windows Kits\8.1\build\WindowsDriver.common.targets 1366 5 HelloWorld Package

5 IntelliSense: identifier “KmdfSmallEvtDeviceAdd” is undefined c:\HelloWorld\HelloWorld\Driver.c 14 34 HelloWorld

I think the main issue is the undeclared identifier, which I would imagine is because I’m missing a library; however, I have not been able to find what library to include.

My system is Win7 64-bit.

Thanks in advance!

J. Brett Cunningham

— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Don - Though I did not change from the sample, the issue you pointed out
seems to be the issue and that resolved it.

Peter - Thank you for your response. Between you and Don, I realize what
the error was and how trivial it was to overcome.

Thank you both very much for your help.

On Wed, Sep 3, 2014 at 4:48 PM, Don Burn wrote:

> From the sample did you change:
>
>
>
> EVT_WDF_DRIVER_DEVICE_ADD KmdfHelloWorldEvtDeviceAdd;
>
>
>
> To
>
>
>
> EVT_WDF_DRIVER_DEVICE_ADD KmdfSmallEvtDeviceAdd;
>
>
>
> It looks like to me that you are missing the definition.
>
>
>
>
>
> Don Burn
>
> Windows Filesystem and Driver Consulting
>
> Website: http://www.windrvr.com
>
>
>
>
>
>
>
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] *On Behalf Of *Brett Cunningham
> Sent: Wednesday, September 03, 2014 4:37 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] First driver - compilation help
>
>
>
> Hi,
>
>
>
> I am working my way through my first driver and was using OSR and the
> following Microsoft article:
> http://msdn.microsoft.com/en-us/library/windows/hardware/hh439665(v=vs.85).aspx
>
>
>
> My code is copy and pasted from the article.
>
>
>
> Error 1 error C2065: ‘KmdfSmallEvtDeviceAdd’ : undeclared
> identifier c:\HelloWorld\HelloWorld\Driver.c 14
> 1 HelloWorld
>
> Warning 2 warning C4047: ‘function’ :
> ‘PFN_WDF_DRIVER_DEVICE_ADD’ differs in levels of indirection from ‘int’
> c:\HelloWorld\HelloWorld\Driver.c 14 1 HelloWorld
>
> Warning 3 warning C4024: ‘WDF_DRIVER_CONFIG_INIT’ :
> different types for formal and actual parameter 2
> c:\HelloWorld\HelloWorld\Driver.c 14 1 HelloWorld
>
> Error 4 error MSB3030: Could not copy the file
> “c:\HelloWorld\x64\Win7Debug\HelloWorld.sys” because it was not
> found. C:\Program Files (x86)\Windows
> Kits\8.1\build\WindowsDriver.common.targets 1366 5
> HelloWorld Package
>
> 5 IntelliSense: identifier “KmdfSmallEvtDeviceAdd” is
> undefined c:\HelloWorld\HelloWorld\Driver.c 14
> 34 HelloWorld
>
>
>
>
>
> I think the main issue is the undeclared identifier, which I would imagine
> is because I’m missing a library; however, I have not been able to find
> what library to include.
>
>
>
> My system is Win7 64-bit.
>
>
>
> Thanks in advance!
>
>
>
> J. Brett Cunningham
>
>
>
> — NTDEV is sponsored by OSR Visit the list at:
> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
> http://www.osr.com/careers For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>