Hi can any one tell me how to solve this problem ?
here is my code
#ifndef _GetComponentFunction_H
#define _GetComponentFunction_H
namespace fb
{
//Minimap
fb::ClientSpottingTargetComponent *cstc = soldier->getComponent<fb::ClientSpottingTargetComponent>( "ClientSpottingTargetComponent" );
cstc->m_spotType = fb::SpotType_Active;
#endif
I assume there is a header file defining ClientSpottingTargetComponent that you need to include.
Be aware you might need to add relevant source files too, or link against a relevant library.
Related
I have a header file (A):
namespace CChristianLifeMinistryDefines
{
using S_DISCUSSION_HIST_ITEM = struct tagDiscussionHistItem
{
CString strName;
Schools eSchool;
COleDateTime datMeeting;
};
using DiscussionItemHistList = list<S_DISCUSSION_HIST_ITEM>;
}
The above header file is included in another header file (B):
#include "ChristianLifeMinistryDefines.h"
using namespace CChristianLifeMinistryDefines;
enum class Schools
{
kMain,
kClass1,
kClass2,
kCount
};
The problem I have (and I understand why) is that Schools is referred to in the S_DISCUSSION_HIST_ITEM structure which is defined before the Schools enum.
Error C3646: 'eSchool': unknown override specifier
The enum was already defined in my project and can't be moved else things might break down when compiling.
What I have done is move the class definition from file B to file A. But was there another solution to this? I couldn't simply include header B in header A because I get a circular reference and I can't get my head around what I found on the internet.
Is there any tool to update .rgs files to reflect change made in the IDL ?
rgs files are created by the ATL control wizzard but I can't find a way to refresh thoses files.
When we change the uuid of an interface (within the .IDL file), we are forced to changed by hand the "hard copy" values in those .rgs files. This is quiet prone to error.
I found this interesting project that intend to fill this gap but, accordingly the last comments, it didn't works any more since VC2005.
ATL CAtlModule implementation offers virtual CAtlModule::AddCommonRGSReplacements which you can override and add substitutions to remove hardcoded RGS values.
For example, my typical ATL code looks like this:
class CFooModule :
public CAtlDllModuleT<CFooModule>
{
[...]
// CAtlModule
HRESULT AddCommonRGSReplacements(IRegistrarBase* pRegistrar)
{
// Error handling omitted for code brevity
__super::AddCommonRGSReplacements(pRegistrar);
ATLASSERT(m_libid != GUID_NULL);
pRegistrar->AddReplacement(L"LIBID", _PersistHelper::StringFromIdentifier(m_libid));
pRegistrar->AddReplacement(L"FILENAME", CStringW(PathFindFileName(GetModulePath())));
pRegistrar->AddReplacement(L"DESCRIPTION", CStringW(AtlLoadString(IDS_PROJNAME)));
return S_OK;
}
In COM classes I override UpdateRegistry method to add tokens with third parameter of standard call _pAtlModule->UpdateRegistryFromResource.
As a result, many .RGS are shared between COM classes because hardcoded values are replaced with tokens. Specifically, there are no GUIDs in RGS files, e.g.:
HKCR
{
NoRemove CLSID
{
ForceRemove %CLSID% = s '%DESCRIPTION%'
{
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
val AppID = s '%APPID%'
TypeLib = s '%LIBID%'
}
}
}
I'm not able to understand how %CLSID% is replaced with the COM class CLSID in roman-r's answer. There seem to be something missing in the answer.
Alternative solution from CodeProject: Registry Map for RGS files.
This solution introduces a custom registrymap.hpp header with a DECLARE_REGISTRY_RESOURCEID_EX extension that allows you to add RGS substitution macros to your COM classes. Example:
BEGIN_REGISTRY_MAP(CClassName)
REGMAP_ENTRY("PROGID", "MyLibrary.ClassName")
REGMAP_ENTRY("VERSION", "1")
REGMAP_ENTRY("DESCRIPTION", "ClassName Class")
REGMAP_UUID ("CLSID", CLSID_ClassName)
REGMAP_UUID ("LIBID", LIBID_MyLibraryLib)
REGMAP_ENTRY("THREADING", "Apartment")
END_REGISTRY_MAP()
I have these two header files in the following path:
...\xfs\XFS_WINCOR_03\INCLUDE_03_00\xfsbcr.hpp
...\xfs\XFS_WINCOR_03\INCLUDE_03_10\xfsbcr.hpp
Both of them have structures called wfs_bcr_status.
This structure is different in each header file but have the same name.
INCLUDE_03_00\xfsbcr.hpp
typedef struct wfs_bcr_status
{
WORD fwDevice;
WORD fwBCRScanner;
DWORD dwGuidLights[WFS_BCR_GUIDLIGHTS_SIZE];
LPSTR lpszExtra;
} WFSBCRSTATUS, * LPWFSBCRSTATUS;
/////////////////////////////////////////////////////////////////////////
INCLUDE_03_10\xfsbcr.hpp
typedef struct wfs_bcr_status
{
WORD fwDevice;
WORD fwBCRScanner;
DWORD dwGuidLights[WFS_BCR_GUIDLIGHTS_SIZE];
LPSTR lpszExtra;
WORD wDevicePosition;
USHORT usPowerSaveRecoveryTime;
} WFSBCRSTATUS, * LPWFSBCRSTATUS;
In my code I have a cdm_device class that is derived from the device class.
In device I include the first header and I use the structure in my methods.
#include "INCLUDE_03_00/xfsbcr.h"
In cdm_device i include the second header.
#include "INCLUDE_03_00/xfsbcr.h"
In my methods, when I want to get wDevicePosition and usPowerSaveRecoveryTime, I get an error because it's not recognizing the second header file (03_10) and look into the first header file (03_00) and they are not define there.
How can I fix this?
I am trying to call Advapi32.LsaOpenPolicy() from basic MSI InstallShield code. I've successfully called other avdapi32.dll methods; But LsaOPenPolicy is throwing a mismatched type error.
My prototype is:
prototype INT Advapi32.LsaOpenPolicy(POINTER, POINTER, INT, POINTER);
The windows definition is:
NTSTATUS LsaOpenPolicy(
_In_ PLSA_UNICODE_STRING SystemName,
_In_ PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
_In_ ACCESS_MASK DesiredAccess,
_Inout_ PLSA_HANDLE PolicyHandle
);
I've noted in C++ samples that the ObjectAttriibute structure is zeroed out. So I do something similar here in the InstallShield code -- pArray points to the array contents.
for i = 0 to 11
array(i) = 0;
endfor;
array(0) = 24;
// current error is 80020005 type mismatch.
try
i = POLICY_CREATE_ACCOUNT | POLICY_LOOKUP_NAMES;
pArray = array;
pPolicy = NULL;
nvOSResult = LsaOpenPolicy(NULL, pArray, i, pPolicy);
catch
Sprintf(errString, "0x%08x", Err.Number);
_Logger(hMSI, methodName, "LsaOpenPolicy Exception "+errString, INFORMATION, FALSE);
nvOSResult = Err.Number;
endcatch;
There not much other information I can find other than the 80020005 error thrown; I've tried a few different argument constructions, but I can't get past this.
I've posted this in an flexera and microsoft forum -- but I have gotten no traction there. (references for posterity: flexera-link, microsoft-link)
Any help or suggestions are welcome!
The answer to this question was to actually work-around the interface between installshield and the system DLLs by moving all the workings into a C++ DLL. As installation got more complex, I ended up with two separate DLL functions, one executed at dialog (non-admin) mode and one at deferred execution (admin) mode.
In order to pass information I used the MsiGetProperty() API using MSI properties for both input and output variables.
Note that for deferred execution, I needed a CAD function on the installshield side to marshal data into the custom action data location, and on the DLL side extract the data, again by using MsiGetProperty() but getting the "CustomActionData" property and then parse the resulting string which contained the marshaled data.
I am getting VC++ 2010 C2061 error on line:
#include "queryevaluator_p.h"
class QueryEvaluator {
public:
vector<AttrValue>* getCandidateList(QueryClause cl, int pos, ResultSet *computedRes);
...
Error 41 error C2061: syntax error : identifier 'ResultSet' h:\dropbox\sch\cs3202\code\source\includes\queryevaluator.h 40
ResultSet is a struct defined in "queryevaluator_p.h"
struct ResultSet{ //a set of result
bool valid;
vector<ResultRow> rows;
};
Whats wrong here? ResultSet can be used elsewhere
Maybe you have circular includes (queryevaluator_p.h includes the main header again) causing confusion. Depending on the exact setup this can lead to such an effect, because one of the files will have to be compiled first.
The solution would be to resolve the circular dependency by using a forward declaration instead of an include in one place. For example you could forward declare struct ResultSet instead of including the queryevaluator_p.h header.