RPC_CSTR' : undeclared identifier while compile c++ using Nmake - c++

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.

Related

Cannot compile Tomcat Native Library on Windows 10

Background -
I'm using Tomcat 9.0.8 as webserver for an Oracle APEX installation. I now need to make Tomcat FIPS-140 compliant. To this end, I'm trying to build the Tomcat Native Library, incorporating a FIPS-compliant OpenSSL. I've been working from these instructions:
https://www.ysofters.com/2017/07/25/building-and-using-fips-capable-openssl-in-apache-tomcat/
There are "official" Tomcat Native build instructions from Apache, but they require the use of Mladen's Custom Microsoft Compiler Toolkit Compilation, which AFAIK can't be built on Windows 10.
The build steps were as follows:
Build the OpenSSL FIPS Object Module
Build the FIPS capable OpenSSL
Build Apache Portable Runtime
Build Tomcat Native library
The last step is what failed, hence my question today.
Build Configuration -
Windows 10 SDK (10.0.19041.0)
Visual Studio Community 2019 Version 16.9.6
Build Errors -
According to the build docs, I needed to run the following nmake command:
nmake -f NMAKEMakefile WITH_APR=E:\native_build\deps\apr WITH_OPENSSL=E:\native_build\deps\openssl APR_DECLARE_STATIC=1 ENABLE_OCSP=1 WITH_FIPS=1
E:\native_build\deps contains compiled versions of Apache Portable Runtime and OpenSSL, built in the previous steps.
That nmake command results in these errors:
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2146: syntax error: missing ')' before identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2081: 'FILE_INFO_BY_HANDLE_CLASS': name in formal parameter list illegal
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2061: syntax error: identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2059: syntax error: ';'
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1105): error C2059: syntax error: ','
E:\Windows Kits\10\include\10.0.19041.0\um\fileapi.h(1108): error C2059: syntax error: ')'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2146: syntax error: missing ')' before identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2081: 'FILE_INFO_BY_HANDLE_CLASS': name in formal parameter list illegal
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2061: syntax error: identifier 'FileInformationClass'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2059: syntax error: ';'
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9118): error C2059: syntax error: ','
E:\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9121): error C2059: syntax error: ')'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.EXE"' : return code '0x2'
I haven't been able to locate a solution to this, or even another instance of the problem, so hoping you folks have some insights.

Compile error external interface Simulink

I get the compiler error when I attempt to compile a Simulink model to C/C++ code with a external interface:
ert_main.cpp(118) : error C3861: 'rtSetTFinalForExtMode': identifier not found
ert_main.cpp(129) : error C3861: 'rtERTExtModeStartMsg': identifier not found
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
The make command returned an error of 2
The model compiles without errors if the interface is set to "none".
I am using Matlab 2013a (Simulink 8.1). The compiler used is Microsoft Visual 2010 Professional.
The issue has been resolved. For people who are facing the same problem:
- The Siemens WinAC (example) documentation only uses Matlab2012b, consider compiling your model on the 2012b version of Matlab when you're using a different version;
In the Matlab Workspace cd your way to C:\Program Files\Siemens\WinAC\WinAC Target\WinAC Target Files and run the startup.m -file;
DO NOT change the current searchpath location;
DO NOT paste any other source files to this location otherwise you confuse the compiler wich file to take;
In my case I got the following errors:
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(343) : error C2065: 'ODK_YEAR_MAX' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(343) : error C2065: 'ODK_YEAR_MIN' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(346) : error C2065: 'ODK_MON_MAX' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(346) : error C2065: 'ODK_MON_MIN' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(349) : error C2065: 'ODK_DAY_MAX' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(349) : error C2065: 'ODK_DAY_MIN' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(352) : error C2065: 'ODK_HOUR_MAX' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(352) : error C2065: 'ODK_HOUR_MIN' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(355) : error C2065: 'ODK_MIN_MAX' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(355) : error C2065: 'ODK_MIN_MIN' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(358) : error C2065: 'ODK_SEC_MAX' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(358) : error C2065: 'ODK_SEC_MIN' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(361) : error C2065: 'ODK_MILLI_MAX' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(361) : error C2065: 'ODK_MILLI_MIN' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(364) : error C2065: 'ODK_WDAY_MAX' : undeclared identifier
C:\PROGRA~1\Siemens\WinAC\WINACT~1\WINACT~1\src\WinLCReadWriteData.cpp(364) : error C2065: 'ODK_WDAY_MIN' : undeclared identifier
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
To silence this error open the WinLCReadWriteData.cpp -file and comment out lines 343 to 365.
Now it compiles fine, without errors. External mode also works without issues.

How do I make C++/wxWidgets code accessible to a wxPython app?

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"...

Compiling differences in Visual C++ and *nix environments

Is there a difference between compiling projects in *nix environments and MS Visual C++?
For example, there is a "stdafx.h" file in Visual C++.
The reason I'm asking is that I submitted a piece of code which compiled in g++, to refactormycode.com. Then after it got a refactoring, it seemed to include a "stdafx.h", so I figured I'll download Visual C++ 2008 Express but I can't seem to get it to build.
What I'm doing is creating a new project > Create a Win32 Console Application, and replacing the auto-generated .cpp with the refactored code. Am I doing something wrong here?
This is the compiler errors I'm getting:
------ Build started: Project: bfs, Configuration: Debug Win32 ------
Compiling...
bfs.cpp
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(3) : error C2871: 'std' : a namespace with this name does not exist
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(8) : error C2143: syntax error : missing ';' before '<'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(8) : error C2238: unexpected token(s) preceding ';'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(25) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(25) : error C2143: syntax error : missing ';' before '&'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(26) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(28) : warning C4183: 'getEdges': missing return type; assumed to be a member function returning 'int'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(32) : error C2059: syntax error : '<'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(32) : error C2238: unexpected token(s) preceding ';'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(12) : error C2758: 'Vertex::Edges' : must be initialized in constructor base/member initializer list
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(25) : see declaration of 'Vertex::Edges'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(22) : error C2065: 'm_edges' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(22) : error C2228: left of '.push_back' must have class/struct/union
type is ''unknown-type''
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(27) : error C2065: 'm_edges' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(38) : error C2143: syntax error : missing ';' before '<'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(38) : error C2039: 'iterator' : is not a member of '`global namespace''
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(38) : error C2238: unexpected token(s) preceding ';'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(41) : error C2059: syntax error : '<'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(41) : error C2238: unexpected token(s) preceding ';'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(83) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(83) : error C2143: syntax error : missing ';' before '&'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(84) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(86) : warning C4183: 'getVertices': missing return type; assumed to be a member function returning 'int'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(89) : error C2146: syntax error : missing ';' before identifier 'm_vertices'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(89) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(89) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(43) : error C2758: 'Graph::Vertices' : must be initialized in constructor base/member initializer list
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(83) : see declaration of 'Graph::Vertices'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(55) : error C2065: 'm_vertices' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(55) : error C2228: left of '.insert' must have class/struct/union
type is ''unknown-type''
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(61) : error C2065: 'VertexIterator' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(61) : error C2146: syntax error : missing ';' before identifier 'iter'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(61) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2065: 'm_vertices' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2228: left of '.begin' must have class/struct/union
type is ''unknown-type''
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2065: 'm_vertices' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2228: left of '.end' must have class/struct/union
type is ''unknown-type''
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(62) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(64) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(64) : error C2227: left of '->getId' must point to class/struct/union/generic type
type is ''unknown-type''
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(65) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(78) : error C2065: 'VertexIterator' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(78) : error C2146: syntax error : missing ';' before identifier 'iter'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(78) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2065: 'm_vertices' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2228: left of '.begin' must have class/struct/union
type is ''unknown-type''
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2065: 'm_vertices' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2228: left of '.end' must have class/struct/union
type is ''unknown-type''
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(79) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(80) : error C2065: 'iter' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(80) : error C2541: 'delete' : cannot delete objects that are not pointers
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(85) : error C2065: 'm_vertices' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(119) : error C2143: syntax error : missing ';' before '<'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(119) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(119) : error C2238: unexpected token(s) preceding ';'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(106) : error C2065: 'UINT_MAX' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(138) : error C2065: 'queue' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(138) : error C2059: syntax error : 'const'
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(140) : error C2065: 'Attributes' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(142) : error C2065: 'q' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(142) : error C2228: left of '.push' must have class/struct/union
type is ''unknown-type''
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(143) : error C2065: 'q' : undeclared identifier
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(143) : error C2228: left of '.empty' must have class/struct/union
type is ''unknown-type''
c:\users\admin\documents\visual studio 2008\projects\alg\bfs\bfs\bfs.cpp(143) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Build log was saved at "file://c:\Users\Admin\Documents\Visual Studio 2008\Projects\alg\bfs\bfs\Debug\BuildLog.htm"
bfs - 66 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Add the below headers in the refactored code,
#include <iostream>
#include <limits>
#include <map>
#include <list>
#include <queue>
The Visual C++ compiler treats include directives for precompiled headers in a special way, and often they are called stdafx.h, so I'll describe that treatment and see if that's the issue.
Each file using stdafx.h as the precompiled header will have this line at the top.
#include "stdafx.h"
Normally, this means the compiler looks for stdafx.h in the same source folder as the file that included it. However, when stdafx.h is the precompiled header, the Visual C++ compiler automatically includes the project's stdafx.h precompiled output, regardless of where the stdafx.h header or the output is. When the same project is compiled under GCC, GCC won't know where the file is if it's in another folder. You'll have to set the include path of the project appropriately so each preprocessor-related #include can find the proper file.
Normally, when an include file is located in an unknown folder specified only by a compiler [-I] directive, the include is written as:
#include <filename.h>
Unfortunately, Visual C++ doesn't let you use this notation for the precompiled header, and you have to rely on GCC following the include paths even for files specified with "" (double quotes). This behavior may or may not be in the C++ standard, but the one thing you'll want to make sure of is you don't have any extra/unintended stdafx.h files in the source tree, or you may run into even more unexpected compiled-code differences between VC++ and GCC.
The refactored code is missing certain includes. More than likely they are included in the precompiled header, stdafx.h, which usually isn't a good idea. Add the following includes to the bfs.cpp file, in between the "stdafx.h" include and the "using" declaration:
#include "stdafx.h"
#include <set>
#include <list>
#include <map>
#include <queue>
#include <iostream>
using namespace std;
Compiling...
bfs - 0 error(s), 0 warning(s)
Perhaps try:
#include <stdafx.h> // note angle brackets
This is different from the page you linked, which looks for stdafx.h in the current directory.
Or have you tried replacing that with the #includes in the original file?
For creating a new project , I recommend this :
New Project-> Empty Project
Then,
Project->Add New Item...-> C++ File (.cpp)
It's different from Win32 Console Application.

Ms Sitelock 1.15 and VS 2005

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