Microsoft Windows UVC Extension Unit sample compilation troubleshooting - c++

I have been trying recently to get UVC (USB Video Class) extension unit up and running.I did make some progress (by getting vidcap_i.c by a lead from a message from another forum),but I have not been able to go through due to compilation errors and I hope I could get some help here for the subject.
I have created all the necessary files ,which I was guided by the sample at Microsoft site,except the sample application.
Their content is the same as at the UVC sample link.
*Note:I got a little confused by the line that says "Copy Extend.def from the WIA extend sample and edit it. Uvcxuplugn.def should contain".I hope I got it correctly - I have copied the extend.def file from WDK samples directory to
c:\xu directory ,edited the file ,added the necessary content and saved it as Uvcuplugn.def file.
After building using the Build environment ,this is the output of the compilation :
C:\xu>Build -cZg
BUILD: Compile and Link for AMD64
BUILD: Start time:
BUILD: Examining c:\xu directory for files to compile.
c:\xu Invalidating OACR warning log for 'root:amd64chk'
BUILD: Building generated files in c:\xu directory
Configuring OACR for 'root:amd64chk' -
Running MIDL on - interface.idl
BUILD: Compiling c:\xu directory
Compiling - interface_i.c
Compiling - vidcap_i.c
Compiling - uvcxuplgn.cpp
1>errors in directory c:\xu
1>c:\xu\xuproxy.h(69) : error C2017: illegal escape sequence
1>c:\xu\xuproxy.h(71) : error C2059: syntax error : '__uuidof'
1>c:\xu\xuproxy.h(71) : error C2017: illegal escape sequence
1>c:\xu\xuproxy.h(71) : error C2332: 'struct' : missing tag name
1>c:\xu\xuproxy.h(71) : error C2011: '' : 'enum' type redefinition
1>c:\xu\uvcxuplgn.cpp(7) : error C2143: syntax error : missing ';' before '{'
1>c:\xu\uvcxuplgn.cpp(7) : error C2447: '{' : missing function header (old-style
formal list?)
1>c:\xu\uvcxuplgn.cpp(31) : error C2065: 'ObjectMap' : undeclared identifier
Compiling - stdafx.cpp
Compiling - xuproxy.cpp
Building Library - objchk_win7_amd64\amd64\uvcxuplgn.lib
1>link : error LNK1181: cannot open input file 'c:\xu\objchk_win7_amd64\amd64\uv
cxuplgn.obj'
BUILD: Compile errors: not linking c:\xu directory
BUILD: Finish time:
BUILD: Done
12 files compiled - 1 Warning - 8 Errors
1 library built - 1 Error
I get the same errors no matter what the target is (x86,x64,ia64)
Now,let's review errors one by one ,starting from the last :
LNK1181->No idea about that error.I have done clean ups of the build and that did not help
at all.But this is probably the easiest error to resolve,hope you would be able to give me
a lead on the subject.
uvcxuplgn.cpp,Line 7 ,the problematic syntax is :BEGIN_OBJECT_MAP(ObjectMap).
According to Microsoft's documentation (http://msdn.microsoft.com/en-us/library/10fb0d3e(v=vs.90).aspx) , this directive is defined at atlcom.h,which is included
in the file ,so I am really confused about the cause of this error.
The last errors relate to last 5 lines of extension unit proxy header file (cannot post code here due to errors-check this page (http://msdn.microsoft.com/en-us/library/windows/hardware/ff568134(v=vs.85).aspx)
Again,no idea ,why it shouldn't compile.Hope I could get some lead on the subject
Sorry for the long post,hope you could help me (and probably many others) who struggle with this Windows UVC extension unit subject

First, you always have to look at the first error that happens. The others are often following errors. So just delete the wrong escape sequence () in line 69 and in line 71 in xuproxy.h.
The linking error only happens, because the compiler couldnt compile the .cpp files earlier, so the object file is missing.

Related

Error D8003: missing source filename and CMap

I'm working on a C++ solution. It builds and runs just fine on my main computer, but transferring it to a different computer results in those build errors:
Error D8003: missing source filename in cl
Error C2143: syntax error : missing ';' before '<' at the declaration of a CMap in the header file.
Could someone direct me to the possible causes of this?
It does seem that you need to have #include <afxtempl.h> in your src/header file.

load an image from an url using opencv and cURL

I am trying to load an image from an url and display it.I am using opencv in c++ and cURL libraries.I am used to working with opencv,but I don't have any experience working with cURL libraries. I just need curl to load an image and save it in a cv::Mat file, so that I could display it. So, I took code from here.It is supposed to be working,but I am getting syntax errors.
Also,I tried this code from opencv.org. But,I am getting same errors
Errors are
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: syntax error : identifier 'acosf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: syntax error : ';'
and about 90 syntax errors.When I click on errors it is opening cmath file and I cant find any syntax errors there.
Thank you for the help.
EDIT 1: I compiled the code as c++ and got rid of the above errors.Now I got a new error
OpenCV Error: Assertion failed (buf.data && buf.isContinuous()) in cv::imdecode_, file ........\opencv\modules\highgui\src\loadsave.cpp
It looks like you are compiling for c and not c++. Check two things:
Code file extension is .cpp and not .c.
Check the compilation properties:
Tools bar -> Project -> Properties (or Alt + F7)->Configuration Properties -> C/C++ -> Advanced -> Compile As: "Compile as C++ Code".

loadlibrary in 64-bit Matlab?

I am trying to load a C++ API (for the BB60C radio at SignalHound.com) into Matlab using loadlibrary() but it is only working in 32-bit Matlab (R2014a). The zip file here contains the bb_api.h header file and has both a 32-bit and 64-bit bb_api.dll in their respective folder. To run it, I copy the correct .dll into the folder with bb_api.h and call loadlibrary('bb_api','bb_api.h'). While this works for the 32-bit version, when I use the 64-bit .dll in 64-bit Matlab, I get the following error:
Error using loadlibrary (line 422)
Building bb_api_thunk_pcwin64 failed. Compiler output is:
cl -I"C:\Program Files\MATLAB\R2014a\extern\include" /W3 /nologo /D_CRT_SECURE_NO_DEPRECATE
/D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 -I"C:\Program Files\MATLAB\R2014a\extern\include" -I"C:\Program
Files\MATLAB\R2014a\simulink\include" -I"C:\Users\mimhof\Documents\GitHub\SDR\Matlab"
-I"C:\Users\mimhof\Documents\GitHub\SDR\Matlab" "bb_api_thunk_pcwin64.c" -LD -Fe"bb_api_thunk_pcwin64.dll"
bb_api_thunk_pcwin64.c
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(202) : error C2061: syntax error : identifier 'bbOpenDevice'
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(202) : error C2059: syntax error : ';'
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(202) : error C2059: syntax error : 'type'
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(203) : error C2061: syntax error : identifier 'bbCloseDevice'
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(203) : error C2059: syntax error : ';'
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(203) : error C2059: syntax error : 'type'`
and so on for all the methods available in the API. What would cause this error to occur in 64-bit and not 32-bit?
Thanks!
You talk about using C++, but your file is named .c, which triggers compilation using the C language rules. The Microsoft compiler's C support is pretty outdated, and it's likely that is the source of your problems. You may want to use C++ instead.
Beyond that, take a close look at the line where the error occurs, just as if you were fixing compile errors in your own code.
The ***_thunk.c file is auto-generated by a perl script shipped with matlab, and is the source of many similar errors.
This fact (the auto generated thunk source is in c) is the source of many documented seemingly weird loadlibrary limitations and many more undocumented ones.
My solution when being hit by a very similar issue was to hijack this auto-generated file, rename it to cpp and build my own cpp version of the thunk. This required some hacking, as this file lifespan is a fraction of a second. Full details are here.

C++/CX and Amazon Product Advertising API

Language: C++/CX & XAML
Environment: Visual Studio 2013 on Windows 8.1
I am trying to use the Amazon Product Advertising API in my Windows Store app. I have an Associates account so I am allowed to use this however I'm having problems implementing the .wsdl file after using wsutil.exe to create a .c and .h file for my project.
The .c and .h files both have errors pointing to identifiers that reside inside WebServices.h.
Since the .c and .h files have a combined length of more than 13k lines of code I'll write out steps to reproduce my problem.
-Navigate to http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl
-Save the file either in a project fold or on the desktop
-Open up a VS2013 command prompt and navigate to where the file resides
-Type "wsutil /wsdl:AWSECommerceService.wsdl"
This produces the .c and .h files that can be used in the project
-Add the .c and .h files to a VC++ Windows Store app project
since the environment language is C++/CX and wsutil gave us a .c file we need to tell the compiler to treat this file as a C++ file otherwise if you try to build like it is it throws an error saying:
Command line error D8048: cannot compile C file '....\New folder\AWSECommerceService.wsdl.c' with the /ZW option
My first attempt at trying to fix this was to remove the /ZW option.
This can be done by right clicking the .c file, click properties, under "General" you will will see "yes(/ZW)" which you can change to "no".
after doing this and trying to build it gives this error:
...\awsecommerceservice.wsdl.c : fatal error C1853: 'Debug\SimpleShop.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)
That wasn't the correct fix so I went back and added the /ZW option.
Next I decided to tell the compiler to treat the .c file as a .cpp file by adding the /TP option. You can find this by right clicking the .c file, clicking properties, click Advanced, click the drop down box next to "Compile as" and selected /TP.
Now when trying to build the project errors appear in both the .c and .h files for identifiers that reside in the WebServices.h file.
This is where I'm stuck at. I tried to #include "WebServices.h" into the .h file (which is oddly missing it whereas the .c file is not) and this does nothing to remove any of the errors.
I can find nothing about using the Amazon Product Advertising API inside a windows store app on the internet so all of the attempted fixes came from Win7 or WCF forums. The steps I'm trying to follow are from Amazon on they can be found here (focus on step 4):
http://docs.aws.amazon.com/AWSECommerceService/latest/GSG/GettingSetUp.html
these are the errors:
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1037): error C2371: '_RelatedItems::RelatedItemCount' : redefinition; different basic types
1> c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1034) : see declaration of '_RelatedItems::RelatedItemCount'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1576): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1604): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1632): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1660): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1688): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1716): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1744): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1772): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1800): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1828): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(1856): error C2061: syntax error : identifier 'WS_SERVICE_SECURITY_CALLBACK'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(2709): error C2146: syntax error : missing ';' before identifier 'AWSECommerceServiceBinding'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.h(2709): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.c(1159): error C2146: syntax error : missing ';' before identifier 'contractDesc'
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.c(1159): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\scott\desktop\new folder\awsecommerceservice.wsdl.c(6674): fatal error C1903: unable to recover from previous error(s); stopping compilation
There are several things going on here:
You need to include the header pch.h at the top of the generated .c file
This sounds like a genuine error in the generated header. Notice a member defined twice.
typedef struct _RelatedItems
{
enum _Relationship Relationship;
WCHAR* RelationshipType;
unsigned __int64 RelatedItemCount;
unsigned __int64 RelatedItemPageCount;
unsigned __int64 RelatedItemPage;
unsigned int RelatedItemCount;
_Field_size_(RelatedItemCount)struct _RelatedItem* RelatedItem;
} _RelatedItems;
The other errors are because the missing identifiers are actually not available for Windows Store apps. Both WS_SERVICE_SECURITY_CALLBACK and WS_CONTRACT_DESCRIPTION are conditionally defined in the SDK header WebServices.h only for Desktop apps
"if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"

Unable to compile MEX

I am trying to compile some MATLAB MEX files from C++ source. The files I am trying to compile can be found here; I am using Windows XP on a 32-bit system, MATLAB 2012a and have installed the Microsoft Windows SDK v7.1 to use as my compiler.
MATLAB outputs the following error if I try to compile:
>> mex -O -largeArrayDims osc_free_address.c
osc_free_address.c
osc_free_address.c(1) : error C2059: syntax error : '<'
osc_free_address.c(37) : error C2015: too many characters in constant
osc_free_address.c(38) : error C2059: syntax error : '<'
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(41) : error C2018: unknown character '0x40'
osc_free_address.c(43) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(46) : error C2059: syntax error : '<'
osc_free_address.c(82) : fatal error C1021: invalid preprocessor command 'page'
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'osc_free_address.c' failed.
Error using mex (line 206)
Unable to complete successfully.
I have used mex -setup to setup my compiler with Microsoft Windows SDK v7.1. Interestingly, although I have them installed on my system, MATLAB doesn't see MS Visual Studio C++ 2008 or 2010. I have also tried compiling with the Lcc-win32 C 2.4.1 compiler (which is recognised by MATLAB), to the same effect as shown above.
I understand that this particular set of C++ source files might require something called liblo to compile (I'm not sure whether this is a requirement at compile-time or run-time); as far as I'm aware I have installed these correctly, but there's a possibility that the problem might lie here too.
Any help would be greatly appreciated.
Try renaming your .c files to .cpp and re-compile
>> mex -largeArrayDims -O osc_free_address.cpp
Moreover, why don't you try the build m file that comes with the package
(as suggested in this question)?
Have you downloaded and compiled liblo? you might need to add the include path and library path for it in the mex command?
>> mex -largeArrayDims -O -I<liblo include path> -L<liblo lib path> -llo osc_free_address.cpp