I'm trying to implement the MS Sitelock template into one of my Active-X Controls. I've downloaded the sitelock 1.15 sdk and I'm stuck on the very first step.
Including the sitelock.h header file causes a bunch of compile errors that have to do with the sal.h header file. It looks to me like sitelock.h wants to use attribute sal but that sal.h is only defining declspec sal. I'm using VS 2005, but the sitelock 1.5 documentation says that vs 2005 is supported. Is there something I need to do to reference attribute sal? I do have the Vista platform sdk installed. I'm including the sitelock.h in the header file of my active-x object. Perhaps that's not the place to do it?
See compile errors below:
....\public\sitelock.h(308) : error C2061: syntax error : identifier '_In_opt_count_'
..\..\public\sitelock.h(605) : see reference to class template instantiation 'CSiteLock<T>' being compiled
\public\sitelock.h(308) : error C2059: syntax error : ')'
...\public\sitelock.h(310) : error C2143: syntax error : missing ')' before '{'
...\public\sitelock.h(401) : error C2061: syntax error : identifier '_In_z_'
..\public\sitelock.h(401) : error C2059: syntax error : ')'
..\public\sitelock.h(402) : error C2143: syntax error : missing ')' before '{'
C2061: syntax error : identifier '_Inout_z_count_'
....\public\sitelock.h(451) : error C2059: syntax error : ')'
...\public\sitelock.h(452) : error C2143: syntax error : missing ')' before '{'
..\public\sitelock.h(520) : error C2061: syntax error : identifier '_In_z_'
..\public\sitelock.h(520) : error C2059: syntax error : ')'
...\public\sitelock.h(521) : error C2143: syntax error : missing ')' before '{'
...\public\sitelock.h(555) : error C2061: syntax error : identifier '_In_z_'
New SAL.H is included in the Windows server 2008 SDK, not the Vista one.
I'm still using the Vista SDK and have gotten by my compiler errors by translating the attribute sal macros to declspec sal macros in sitelock.h.
Used the notes in the following url to do the translation:
http://blogs.msdn.com/sdl/archive/2009/06/11/a-declspec-sal-to-attribute-sal-rosetta-stone.aspx
Related
I have tried downloading the C++ OpenCV Library to Visual Studio 2019.
When trying to compile my code, I am getting these errors:
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(40,9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(40,19): error C2059: syntax error: 'constant'
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(42,1): error C2143: syntax error: missing ';' before '{'
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(42,1): error C2447: '{': missing function header (old-style formal list?)
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(68,62): error C2039: 'has_parenthesis_operator': is not a member of 'cv::sfinae'
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(39): message : see declaration of 'cv::sfinae'
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(68,1): error C2065: 'has_parenthesis_operator': undeclared identifier
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(68,1): error C2977: 'std::enable_if': too many template arguments
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xtr1common(46): message : see declaration of 'std::enable_if'
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(68,117): error C2955: 'std::enable_if': use of class template requires template argument list
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xtr1common(46): message : see declaration of 'std::enable_if'
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(68,131): error C2988: unrecognizable template declaration/definition
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(68,131): error C2059: syntax error: '>'
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(69,11): error C2988: unrecognizable template declaration/definition
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(69,11): error C2059: syntax error: 'public'
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(69,1): error C2143: syntax error: missing ';' before '{'
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(69,1): error C2447: '{': missing function header (old-style formal list?)
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(80,26): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(140): message : see reference to class template instantiation 'cv::Ptr<T>' being compiled
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(80,35): error C2059: syntax error: 'constant'
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(80,26): error C2334: unexpected token(s) preceding ':'; skipping apparent function body
1>C:\opencv-4.5.4\opencv\build\include\opencv2\core\cvstd_wrapper.hpp(140,1): fatal error C1903: unable to recover from previous error(s); stopping compilation
I suspect it is a linker errors, so I went ahead and made sure I have included all the dependencies and libraries, and I have done as follows, I included the opencv libraries and the library directories and added the additional dependencies:
yet I am still getting the same errors. Does anyone know how I can get rid of them?
Thank you for your help!
Link to the images: https://imgur.com/a/M1UV7yL
I use rpcrt4.lib to generate dll. While generate dll using nmake ( cl.exe compiler) in Visual studio 2003 .Net, getting following error
nstaller\UUIDGenerator.cpp(35) : error C2065: 'RPC_CSTR' : undeclared identifier
installer\UUIDGenerator.cpp(35) : error C2059: syntax error : ')'
installer\UUIDGenerator.cpp(68) : error C2059: syntax error : ')'
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
Cause :
I use following function
UuidToStringA(&uuid, (RPC_CSTR*)&str);
You need to link to rpcrt4.lib, which it sounds like you did.
But you also need to:
#include "Rpcdce.h"
This error
error C2065: 'RPC_CSTR' : undeclared identifier
Means that it doesn't know if this is a class, variable name, etc. That's why it needs the header file.
I'm using the WTTLogger (downloaded from WLK- windows logo kit) in my c++ application. I don't get any compilation/linker errors with an older version of wtt library WTTLog.DLL/lib and WTTlogger.h header file.
But with a latest version of the header file and library , I'm getting the following error in the header file
This is a Microsoft given header file and I'm not able to understand this error in the microsoft given header file. Any inputs would be greatly appreciated.
::
error C2061: syntax error : identifier 'WTTMetadataDefinition'
error C2061: syntax error : identifier 'WTTMetadataReference'
error C2061: syntax error : identifier 'WTTMetadataDefinition'
error C2061: syntax error : identifier 'WTTMetadataReference'
I have a code library which is written in C++ and makes extensive use of the wxWidgets library. I'm now trying to wrap my library (currently using SWIG) so that it's callable from wxPython, but I've hit a wall:
------ Build started: Project: MyLibLib, Configuration: Release_SWIG_OutputForBin Win32 ------
Performing Custom Build Step
In order to function correctly, please ensure the following environment variables are correctly set:
PYTHON_INCLUDE: C:\Python26\include
PYTHON_LIB: C:\Python26\libs\python26.lib
d:\MyProject\Software\MyLib\trunk\MyLib>C:\swigwin-2.0.0\swig.exe -python d:\MyProject\Software\MyLib\trunk\MyLibLib\MyLib.i
d:\MyProject\Software\MyLib\trunk\MyLib>if errorlevel 1 goto VCReportError
d:\MyProject\Software\MyLib\trunk\MyLib>goto VCEnd
Compiling...
MyLib_wrap.c
C:\wxWidgets-2.8.10\include\wx/wxchar.h(886) : warning C4273: '_snprintf' : inconsistent dll linkage
c:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see previous definition of '_snprintf'
C:\wxWidgets-2.8.10\include\wx/buffer.h(127) : error C2061: syntax error : identifier 'wxCharBuffer'
C:\wxWidgets-2.8.10\include\wx/buffer.h(127) : error C2059: syntax error : ';'
C:\wxWidgets-2.8.10\include\wx/buffer.h(127) : error C2449: found '{' at file scope (missing function header?)
C:\wxWidgets-2.8.10\include\wx/buffer.h(127) : error C2059: syntax error : '}'
C:\wxWidgets-2.8.10\include\wx/buffer.h(127) : error C2059: syntax error : ')'
C:\wxWidgets-2.8.10\include\wx/buffer.h(129) : error C2061: syntax error : identifier 'wxWritableCharBuffer'
C:\wxWidgets-2.8.10\include\wx/buffer.h(129) : error C2059: syntax error : ';'
C:\wxWidgets-2.8.10\include\wx/buffer.h(129) : error C2059: syntax error : ':'
C:\wxWidgets-2.8.10\include\wx/buffer.h(134) : error C2061: syntax error : identifier 'wxWCharBuffer'
C:\wxWidgets-2.8.10\include\wx/buffer.h(134) : error C2059: syntax error : ';'
C:\wxWidgets-2.8.10\include\wx/buffer.h(134) : error C2449: found '{' at file scope (missing function header?)
C:\wxWidgets-2.8.10\include\wx/buffer.h(134) : error C2059: syntax error : '}'
C:\wxWidgets-2.8.10\include\wx/buffer.h(134) : fatal error C1004: unexpected end-of-file found
Build log was saved at "file://d:\MyProject\Software\MyLib\trunk\MyLib\Release_SWIG_OutputForBin\BuildLog.htm"
MyLibLib - 13 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Is there a particular way I should be going about this? I spent some time googling for similar errors, but got none which suggests I'm probably barking up the wrong tree here...?
[Edit] Is a dll and ctypes the answer?
[Edit] I tried including the main wx header in there, but it doesn't seem to fix the issue:
%{
#include <wx/wx.h>
%}
Am I going to have to go through and manually add each and every header from wxWidgets? Bear in mind there are a massive number of them!
Looks like your Mylib.i is not emitting in its generated C file to #include the header(s) defining wxCharBuffer and so on (or maybe missing #defines that make those include actually perform the needed function definitions, but that's less likely). Do you have the needed
%{
#include "wxwhatever.h"
%}
and so on in your .i file? Can you look at the generated .c and see what include directives are present or missing (or maybe in the wrong order)?
There's nothing especially tricky (that I know of) about the task you're attempting, and those error messages from the compiler just suggest to me "missing includes or the like"...
I have a code that generates errors on my PC but does't on other PC.I have windows 7 installed and also installed the compatible SDK for windows 7.I have also included the VC directories (from Tools -> option-> vc Diretories) but still the code generates follwing errors.
error C2059: syntax error : 'constant'
error C2238: unexpected token(s) preceding ';'
error C2589: '(' : illegal token on right side of '::'
warning C4091: '' : ignored on left of 'const unsigned int' when no variable is declared
error C2143: syntax error : missing ';' before '::'
error C2059: syntax error : '::'
error C2059: syntax error : 'constant'
error C2238: unexpected token(s) preceding ';'
statement generating error are as following
static const unsigned int MAPVK_VK_TO_CHAR;
const unsigned int KeyLogger :: MAPVK_VK_TO_CHAR = 0x02;
Try selecting MAPVK_VK_TO_CHAR and hitting F12 to see if the symbol is declared elsewhere.
What's MAPVK_VK_TO_CHAR? I ask because the error might indicate that this is some macro.
Why do you make a plain identifier (not a macro) all caps, anyway? That's just begging for one of the thousands of macros in <windows.h> to trample over it. (Not that not making it all caps would prevent that, since <windows.h> sacrilegiously defines many mixed-case macros...)
Otherwise you would have to paste some minimal, compilable example showing the problem.