Problem compiling examples with Visual Studio 2008

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Kamikater

Problem compiling examples with Visual Studio 2008

Post by Kamikater » Wed Oct 14, 2009 7:17 pm

Hi!

I am currently experimenting with V-USB and AVRs. I am currently trying to get the examples, that come with the download, running.

The firmware compiled without any problem with the avrgcc toolchain but I have trouble compiling the commandline-sources.

I tried to use Visual Studio 2008 for compiling. LibUSB-Win32 is installed.
When I just tried to compile the sources in the example folder I got an error that usb.h was missing.
I then added the path to the "lib" folder in libusb-win32 as additional includepath.
Now I get multiple errors all very similar that sound like this:

error LNK2019: link to unresolved external symbol "_usb_control_msg" in function "_usbGetStringAscii"

(translated from the german version)
the symbol an function names vary in the different errors but i think they are all connected.

Can anyone tell me what I'm doing wrong?

Regards, Kamikater

rjburke377
Posts: 7
Joined: Tue Oct 06, 2009 7:01 am

Re: Problem compiling examples with Visual Studio 2008

Post by rjburke377 » Wed Oct 14, 2009 11:23 pm

The hid-data command line compiles for me. I have "C:\Program Files\LibUSB-Win32", and "C:\MingW" installed. Both have usb libraries and header files so I'm not certain which is being picked up from the make file.

Using MingW gcc .... not Visual Studio to compile.

Makefile:

Code: Select all

# Use the following 3 lines on Windows and comment out the 3 above:
USBFLAGS=
USBLIBS=    -lhid -lusb -lsetupapi
EXE_SUFFIX= .exe


/RJ

Kamikater

Re: Problem compiling examples with Visual Studio 2008

Post by Kamikater » Thu Oct 15, 2009 12:53 pm

So how do I use that mingw and makefiles? Is there a step by step tutorial? I have never worked with makefiles or commandline-tools.

I still would prefer a solution with Visual Studio.

Regards, Kamikater

Kamikater

Re: Problem compiling examples with Visual Studio 2008

Post by Kamikater » Thu Oct 15, 2009 4:28 pm

Okay, a little update.

I found some tutorials and after much more search I was able to add the correct path to windows, copied all files from "examples\custom-class\commandline" into "test1" edited the makefile for use in windows. Below is the errorlist i got. Can anyone help me now?

C:\MINGW\TEST1>make
gcc -I/usr/local/include -O -g -Wall -c opendevice.c
In file included from opendevice.c:18:
opendevice.h:26:77: usb.h: No such file or directory
In file included from opendevice.c:18:
opendevice.h:29: error: syntax error before '*' token
opendevice.h:40: error: syntax error before '*' token
opendevice.c:86: error: syntax error before '*' token
opendevice.c: In function `usbGetStringAscii':
opendevice.c:91: warning: implicit declaration of function `usb_get_string_simple'
opendevice.c:91: error: `dev' undeclared (first use in this function)
opendevice.c:91: error: (Each undeclared identifier is reported only once
opendevice.c:91: error: for each function it appears in.)
opendevice.c:91: error: `index' undeclared (first use in this function)
opendevice.c:91: error: `buf' undeclared (first use in this function)
opendevice.c:91: error: `buflen' undeclared (first use in this function)
opendevice.c:93: warning: implicit declaration of function `usb_control_msg'
opendevice.c:93: error: `USB_ENDPOINT_IN' undeclared (first use in this function)
opendevice.c:93: error: `USB_REQ_GET_DESCRIPTOR' undeclared (first use in this function)
opendevice.c:93: error: `USB_DT_STRING' undeclared (first use in this function)
opendevice.c: At top level:
opendevice.c:116: error: syntax error before '*' token
opendevice.c: In function `usbOpenDevice':
opendevice.c:120: error: `usb_dev_handle' undeclared (first use in this function)
opendevice.c:120: error: `handle' undeclared (first use in this function)
opendevice.c:123: warning: implicit declaration of function `usb_find_busses'
opendevice.c:124: warning: implicit declaration of function `usb_find_devices'
opendevice.c:125: warning: implicit declaration of function `usb_get_busses'
opendevice.c:125: warning: assignment makes pointer from integer without a cast
opendevice.c:125: error: dereferencing pointer to incomplete type
opendevice.c:126: error: dereferencing pointer to incomplete type
opendevice.c:126: error: dereferencing pointer to incomplete type
opendevice.c:127: error: `vendorID' undeclared (first use in this function)
opendevice.c:127: error: dereferencing pointer to incomplete type
opendevice.c:128: error: `productID' undeclared (first use in this function)
opendevice.c:128: error: dereferencing pointer to incomplete type
opendevice.c:131: warning: implicit declaration of function `usb_open'
opendevice.c:134: error: `warningsFp' undeclared (first use in this function)
opendevice.c:135: error: dereferencing pointer to incomplete type
opendevice.c:135: error: dereferencing pointer to incomplete type
opendevice.c:135: warning: implicit declaration of function `usb_strerror'
opendevice.c:135: warning: format argument is not a pointer (arg 5)
opendevice.c:140: error: dereferencing pointer to incomplete type
opendevice.c:141: error: dereferencing pointer to incomplete type
opendevice.c:146: error: dereferencing pointer to incomplete type
opendevice.c:146: error: dereferencing pointer to incomplete type
opendevice.c:146: warning: format argument is not a pointer (arg 5)
opendevice.c:150: error: `vendorNamePattern' undeclared (first use in this function)
opendevice.c:152: error: dereferencing pointer to incomplete type
opendevice.c:153: error: dereferencing pointer to incomplete type
opendevice.c:158: error: dereferencing pointer to incomplete type
opendevice.c:158: error: dereferencing pointer to incomplete type
opendevice.c:158: warning: format argument is not a pointer (arg 5)
opendevice.c:162: error: `productNamePattern' undeclared (first use in this function)
opendevice.c:164: error: dereferencing pointer to incomplete type
opendevice.c:165: error: dereferencing pointer to incomplete type
opendevice.c:170: error: dereferencing pointer to incomplete type
opendevice.c:170: error: dereferencing pointer to incomplete type
opendevice.c:170: warning: format argument is not a pointer (arg 5)
opendevice.c:172: error: `serialNamePattern' undeclared (first use in this function)
opendevice.c:173: error: `printMatchingDevicesFp' undeclared (first use in thisfunction)
opendevice.c:175: error: dereferencing pointer to incomplete type
opendevice.c:175: error: dereferencing pointer to incomplete type
opendevice.c:177: error: dereferencing pointer to incomplete type
opendevice.c:177: error: dereferencing pointer to incomplete type
opendevice.c:187: warning: implicit declaration of function `usb_close'
opendevice.c:196: error: `device' undeclared (first use in this function)
MAKE: *** [opendevice.o] Error 1

C:\MINGW\TEST1>

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Problem compiling examples with Visual Studio 2008

Post by maxi » Thu Oct 15, 2009 7:48 pm

In file included from opendevice.c:18:
opendevice.h:26:77: usb.h: No such file or directory


That is the problem. One solution would be to simply copy usb.h from ../libusb-win32/include into ../MinGW/include you will also need to copy libusb.a from ../libusb-win32/lib/gcc into ../MinGW/lib

Then in MSYS type: make -f Makefile.windows and it should compile without errors.

Kamikater

Re: Problem compiling examples with Visual Studio 2008

Post by Kamikater » Sat Oct 17, 2009 12:30 pm

Thanks maxi, that helped a lot!

There were some more files missing but I was able to put all to the correct path so the maker could find them. It finally compiled. So now I'm going to search for a way to do the same with Visual Studio.

Also my hardware works great. HID-mouse worked immediately and custom-class is recognized.

One (hopefully) last question: What driver do I need so the program and the avr can communicate for the custom-class example?

Regards, Kamikater

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Problem compiling examples with Visual Studio 2008

Post by maxi » Sat Oct 17, 2009 3:22 pm

Kamikater wrote:What driver do I need so the program and the avr can communicate for the custom-class example?


You need to make your own, see this post http://forums.obdev.at/viewtopic.php?f=8&t=3140

Kamikater

Re: Problem compiling examples with Visual Studio 2008

Post by Kamikater » Sat Oct 17, 2009 5:44 pm

Okay to keep this thread as a step-by-step tutorial:

Download libusb-win32 device driver !! (I first downloaded the filter driver and couldnt find the wizard)
plug in the hardware
start the ..libusb-win32-device-bin-0.1.12.2\bin\inf-wizard.exe
it generates 2 files
add libusb0.dll and libusb0.sys (both are in the same directory as the wizard) to the same folder where your new generated files are and voila: windows accepts the driver



so now my only problem is: the set-led cant find the device. I always get
"Could not find the USB device "LEDControl" with vid=0x16c0 pid=0x5dc

i checked the device with testlibusb-win.exe and the vid is correct pid=0x05dc (guess thats the same). Any ideas?

that whole developing usb-things is complicated...

I'm glad you are here maxi. I wouldnt have come that far without your help!

Regards, Kamikater

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Problem compiling examples with Visual Studio 2008

Post by maxi » Sat Oct 17, 2009 6:35 pm

Glad I could be of assistance, though I am really not sure what's wrong now. Assuming VID & PID match and you have not changed the name of the device from the default 'LEDControl' check the following:

Does your device show up in Device Manager under LibUSB-Win32 devices as LEDControl (This device is working properly)?

Did you inculde the correct usbconfig.h when you compiled set-led.c? It needs to be same one you used to compile the firmware.

If the above is ok I see no reason for it not to work. Try removing then re-inserting the device and re-run set-led.exe see if that helps.

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Problem compiling examples with Visual Studio 2008

Post by maxi » Sat Oct 17, 2009 9:07 pm

Regarding Visual Studio, I have just finished making myself a USBasp (works an absolute treat btw) so now I porting some of my previous work onto my notebook.
I have been configuring MSVC (2005 Express) for libusb so I put together this quick how-to based on the custom-class example, here goes:

Open MSVC++ and start a new Win32 console application making sure to select 'Empty Project' in the wizard. Now add the Source & Header files (set-led.c, opendevice.c & opendevice.h) to the project.

Note: I first copied the files into the actual project directory though this should not be necessary. If you do so however, you should also copy the firmware directory there too as the contents are required for request id's, VID, PID and device names. You will need to edit the following lines in set-led.c accordingly:

Code: Select all

#include "../firmware/requests.h"   /* custom request numbers */
#include "../firmware/usbconfig.h"  /* device's VID/PID and names */


In my case becomes:

Code: Select all

#include "firmware/requests.h"   /* custom request numbers */
#include "firmware/usbconfig.h"  /* device's VID/PID and names */



Now to setup libusb: Navigate to 'Project' => 'Properties' and under 'C++' => 'General' => 'Additional Include Directories' add the full path to /libusb-win32/include. Click the ellipsis to browse for the folder.

Next, under 'Linker' => 'General' => 'Additional Library Directories' add the full path to /libusb-win32/lib/msvc

Last but not least, under 'Linker' => 'Input' => 'Additional Dependencies' simply add 'libusb.lib' (no path this time!)

<edit>The above steps should carried out for both Debug & Release versions </edit>

That would be it normally but if you try to compile you will likely get an error(s) regarding the use of 'strcasecmp'. Now you can just replace each occurance with _stricmp or you can do what I did and add this define:

Code: Select all

#define strcasecmp _stricmp


Hope it helps someone.

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Problem compiling examples with Visual Studio 2008

Post by maxi » Sun Oct 18, 2009 10:20 pm

What about the hid-data example? I hear you ask (or maybe not).

Anyway, I decided to try out a notion of mine that it might be possible to compile the example project with Visual Studio using the DDK headers from MinGW. To cut a long story short I couldn't do it, which ever way I tried I was blighted by multiple conflicting re-definition errors and have therefore concluded that the DDK shipped with MinGW is totally incompatible with MSVC.

So to test a different theory that it should be possible with the MS Windows Driver Kit (WDK) as opposed to the now depreciated MS Driver Development Kit (DDK).

One 610Mb download later and here goes:

First you need to install WDK, I chose to install only the basic build environment (ie: none of the docs or samples).

Open MSVC and start a new, empty console application as in the custom-class example I posted previously.

Add to the project the Source & Header files (hidtool.c, hiddata.c & hiddata.h) Note that you don't need to include hidsdi.h as this is part of WDK.

You will need to modify some of the #includes so that in hiddata.c

Code: Select all

#include "hidsdi.h"
#include <ddk/hidpi.h>


Becomes:

Code: Select all

#include <hidsdi.h>
#include <hidpi.h>


In hidtool.c you only need to make sure that the #include for usbconfig.h is correct for the VID & PID names (see custom-class example again).

Ok, now to setup WDK: Open 'Project' => 'Properties' and under 'C++' => 'General' => 'Additional Include Directories' add the full path to C:\WinDDK\7600.16385.0\inc\ddk & C:\WinDDK\7600.16385.0\inc\api

Note: the version and directory may be different on your system, click the ellipsis to simply browse for the directories.

Next, under 'Linker' => 'General' => 'Additional Library Directories' add the full path to C:\WinDDK\7600.16385.0\lib\wxp\i386

Note: You have a choice with the above, which library you should choose may depend on your target platform. I chose wxp\i386 as this seemed most applicable in my case.

Under 'Linker' => 'Input' => 'Additional Dependencies' I added: setupapi.lib & hid.lib (No path here!)

To Finish up you'll probably need to add this #define to both hiddata.c & hidtool.c anywhere near the top is ok:

Code: Select all

#define strcasecmp _stricmp


And that's it, you should be good to go!

Important Note: This worked for me, I cannot guarantee it will work all systems (indeed I'm pretty sure it won't). If you are comfortable with MinGW you'd be much better advised to go that route.

I am open to suggestions as to how I might improve either of these mini how-to's. I am happy to answer any questions if I am able.

-maxi

Kamikater

Re: Problem compiling examples with Visual Studio 2008

Post by Kamikater » Mon Oct 19, 2009 2:44 pm

Okay, its me again with an update:

I spent some time trying different things and I got the example custom-class completely working now! :)

I changed the crystal to a 12MHz, set the fuese exactly the way it is described in the makefile, I edited the usbconfig.h before creating the commandline-tool and made (F_CPU/1000) to 12000. That all together worked.

I still dont understand why it didnt work with the 16MHz, it showed up correct in the device manager but I will keep trying there. At least, I now have a base to work from.

maxi, I will try out your Visual Studio solutions as soon as possible. I already see some things I forgot ;). Thanks for sharing

Regards, Kamikater

rjburke377
Posts: 7
Joined: Tue Oct 06, 2009 7:01 am

Re: Problem compiling examples with Visual Studio 2008

Post by rjburke377 » Tue Oct 20, 2009 11:58 pm

I changed the hid-data example into a DLL so I can call open, close, setReport, getReport from C#. Works fine. I just used the descriptor in the example "as is" so my payload is 128 bytes.

I've been told that the low level USB transfers are only 8 bytes. Does anyone know if this is true?

/RJ

schwa226
Rank 1
Rank 1
Posts: 20
Joined: Thu Feb 11, 2010 9:20 am

Re: Problem compiling examples with Visual Studio 2008

Post by schwa226 » Thu Apr 01, 2010 1:14 pm

Hi,

I just tried the description from above with the hid-data example.

I modified:

Code: Select all

#include "usbconfig.h"


Code: Select all

#include <hidpi.h>
#include <hidsdi.h>


Installed WDK 710. Added pathes like above. Using VS2008 SP1

When I try to compile:
1>------ Build started: Project: NewConsole, Configuration: Debug Win32 ------
1>Compiling...
1>hiddata.c
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(54) : error C2016: C requires that a struct or union has at least one member
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(54) : error C2061: syntax error : identifier 'USAGE'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(55) : error C2061: syntax error : identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(55) : error C2059: syntax error : ';'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(56) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(62) : error C2016: C requires that a struct or union has at least one member
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(62) : error C2061: syntax error : identifier 'USAGE'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(69) : error C2061: syntax error : identifier 'LinkUsage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(69) : error C2059: syntax error : ';'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(70) : error C2061: syntax error : identifier 'LinkUsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(70) : error C2059: syntax error : ';'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(80) : error C2016: C requires that a struct or union has at least one member
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(80) : error C2061: syntax error : identifier 'USAGE'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(84) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(86) : error C2016: C requires that a struct or union has at least one member
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(86) : error C2061: syntax error : identifier 'USAGE'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(90) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(91) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(93) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(98) : error C2016: C requires that a struct or union has at least one member
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(98) : error C2061: syntax error : identifier 'USAGE'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(105) : error C2061: syntax error : identifier 'LinkUsage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(105) : error C2059: syntax error : ';'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(106) : error C2061: syntax error : identifier 'LinkUsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(106) : error C2059: syntax error : ';'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(114) : error C2040: 'Reserved' : 'UCHAR' differs in levels of indirection from 'ULONG [10]'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(118) : error C2040: 'Reserved2' : 'USHORT [5]' differs in levels of indirection from 'USHORT'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(128) : error C2016: C requires that a struct or union has at least one member
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(128) : error C2061: syntax error : identifier 'USAGE'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(132) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(135) : error C2016: C requires that a struct or union has at least one member
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(135) : error C2061: syntax error : identifier 'USAGE'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(139) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(140) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(141) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(197) : error C2016: C requires that a struct or union has at least one member
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(197) : error C2061: syntax error : identifier 'USAGE'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(198) : error C2061: syntax error : identifier 'LinkUsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(198) : error C2059: syntax error : ';'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(203) : error C2143: syntax error : missing '{' before ':'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(203) : error C2059: syntax error : ':'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(204) : error C2143: syntax error : missing '{' before ':'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(204) : error C2059: syntax error : ':'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(205) : error C2143: syntax error : missing '{' before ':'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(205) : error C2059: syntax error : ':'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(207) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(235) : error C2016: C requires that a struct or union has at least one member
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(235) : error C2061: syntax error : identifier 'USAGE'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(236) : error C2061: syntax error : identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(236) : error C2059: syntax error : ';'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(240) : error C2369: 'Reserved' : redefinition; different subscripts
1> c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(77) : see declaration of 'Reserved'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(255) : error C2059: syntax error : '}'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(306) : error C2146: syntax error : missing ')' before identifier 'Capabilities'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(306) : error C2081: 'PHIDP_CAPS' : name in formal parameter list illegal
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(306) : error C2085: 'HidP_GetCaps' : not in formal parameter list
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(306) : error C2146: syntax error : missing ',' before identifier 'Capabilities'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(307) : error C2059: syntax error : ')'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(323) : error C2061: syntax error : identifier '__drv_maxIRQL'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(354) : error C2146: syntax error : missing ')' before identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(354) : error C2081: 'USAGE' : name in formal parameter list illegal
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(354) : error C2085: 'HidP_GetSpecificButtonCaps' : not in formal parameter list
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(354) : error C2146: syntax error : missing ',' before identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(355) : error C2059: syntax error : 'type'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(360) : error C2059: syntax error : ')'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(417) : error C2146: syntax error : missing ')' before identifier 'ButtonCaps'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(417) : error C2081: 'PHIDP_BUTTON_CAPS' : name in formal parameter list illegal
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(417) : error C2085: 'HidP_GetButtonCaps' : not in formal parameter list
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(417) : error C2146: syntax error : missing ',' before identifier 'ButtonCaps'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(418) : error C2059: syntax error : 'type'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(420) : error C2059: syntax error : ')'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(427) : error C2146: syntax error : missing ')' before identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(427) : error C2081: 'USAGE' : name in formal parameter list illegal
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(427) : error C2085: 'HidP_GetSpecificValueCaps' : not in formal parameter list
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(427) : error C2146: syntax error : missing ',' before identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(428) : error C2059: syntax error : 'type'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(433) : error C2059: syntax error : ')'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(492) : error C2146: syntax error : missing ')' before identifier 'ValueCaps'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(492) : error C2081: 'PHIDP_VALUE_CAPS' : name in formal parameter list illegal
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(492) : error C2085: 'HidP_GetValueCaps' : not in formal parameter list
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(492) : error C2146: syntax error : missing ',' before identifier 'ValueCaps'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(493) : error C2059: syntax error : 'type'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(495) : error C2059: syntax error : ')'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(506) : error C2085: 'HidP_GetExtendedAttributes' : not in formal parameter list
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(531) : error C2061: syntax error : identifier '__drv_maxIRQL'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(653) : error C2085: 'HidP_GetData' : not in formal parameter list
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(699) : error C2061: syntax error : identifier '__drv_maxIRQL'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(732) : error C2146: syntax error : missing ')' before identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(732) : error C2081: 'USAGE' : name in formal parameter list illegal
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(732) : error C2061: syntax error : identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(732) : error C2059: syntax error : ';'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(732) : error C2059: syntax error : ','
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(739) : error C2059: syntax error : ')'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(826) : error C2146: syntax error : missing ')' before identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(826) : error C2081: 'USAGE' : name in formal parameter list illegal
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(826) : error C2061: syntax error : identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(826) : error C2059: syntax error : ';'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(826) : error C2059: syntax error : ','
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(833) : error C2059: syntax error : ')'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(919) : error C2146: syntax error : missing ')' before identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(919) : error C2081: 'USAGE' : name in formal parameter list illegal
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(919) : error C2061: syntax error : identifier 'UsagePage'
1>c:\VS2008\winddk\7600.16385.1\inc\api\hidpi.h(919) : fatal error C1003: error count exceeds 100; stopping compilation
1>hidtool.c
1>c:\temp\vusb-20090822\examples\hid-data\commandline\hidtool.c(30) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(366) : see declaration of 'sprintf'
1>c:\temp\vusb-20090822\examples\hid-data\commandline\hidtool.c(78) : warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 9.0\vc\include\string.h(166) : see declaration of 'strtok'
1>Generating Code...
1>Build log was saved at "file://c:\Temp\vusb-20090822\examples\hid-data\commandline\NewConsole\Debug\BuildLog.htm"
1>NewConsole - 102 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Can somebody upload a sample project for VS2008!?

THX!

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Problem compiling examples with Visual Studio 2008

Post by maxi » Thu Apr 01, 2010 9:01 pm

Hi, I could post a VS2005(Express) project file but I doubt it would help you, the dirs and versions will almost certainly be different to yours. Probably best you tell us a bit more about your setup, eg Operating System, which ddk libs you linked and directories included etc.

Post Reply