Microsoft Platform SDK; which version?

Right, 'nother problem. I'm following the Idiot's Guide to Editing the DLL, specifically the "adding a new boolean tag" section, and just before the CvGameTextMgr section, it told me to compile and test. So I tried to compile (well, Debug->Build Solution, which I assume to be pretty much the same). Then I first get a string of errors along the lines of

Code:
1>CvInfos.cpp(6323): error C2270: 'isUnique' : modifiers not allowed on nonmember functions
1>CvInfos.cpp(6324): error C2065: 'm_bUnique' : undeclared identifier
1>CvInfos.cpp(6338): error C3861: 'm_bUnique': identifier not found, even with argument-dependent lookup
1>CvInfos.cpp(8735): error C2614: 'CvBuildingClassInfo' : illegal member initialization: 'm_bUnique' is not a base or member
1>CvInfos.cpp(8790): error C2039: 'isUnique' : is not a member of 'CvBuildingClassInfo'

and then suddenly this:

Code:
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
1>  Stop.
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "nmake Release" exited with code 2.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

What, if anything, did I do wrong? And how can I go about correcting it?
 
It would be helpful if you post your code, but I'm guessing you defined isUnique as a regular function instead of adding it to the CvBuildingClassInfo class.

In CvInfos.cpp (line 6323) Instead of:
Code:
bool isUnique() const

write:
Code:
bool [B]CvBuildingClassInfo::[/B]isUnique() const

And I guess isUnique and m_bUnique are not declared in the CvBuildingClassInfo class declaration which sits in CvInfos.h.

after 'class CvBuildingClassInfo' where you see all the 'isSomething' functions (for example, the line which declares isNoUnhappiness), add:
Code:
bool isUnique(...) const;
(assuming it doesn't get any parameters).

And in the section where members are defined (look for m_bNoUnhappiness), add:
Code:
bool m_bUnique;

EDIT: crossed with NotSoGood...
 
I googled your error and I think it might be that you forgot the CvBuildingClassInfo:: before the isUnique.

It would be helpful if you post your code, but I'm guessing you defined isUnique as a regular function instead of adding it to the CvBuildingClassInfo class.

In CvInfos.cpp (line 6323) Instead of:
Code:
bool isUnique() const

write:
Code:
bool [B]CvBuildingClassInfo::[/B]isUnique() const

And I guess isUnique and m_bUnique are not declared in the CvBuildingClassInfo class declaration which sits in CvInfos.h.

No, I followed the Guide to the letter (except the bits about putting the new code in second-to-last, but I made sure I put commas and semicolons where needed). I have declared isUnique and m_bUnique, exactly where the Guide says.

after 'class CvBuildingClassInfo' where you see all the 'isSomething' functions (for example, the line which declares isNoUnhappiness), add:
Code:
bool isUnique(...) const;
(assuming it doesn't get any parameters).

And in the section where members are defined (look for m_bNoUnhappiness), add:
Code:
bool m_bUnique;

isNoUnhappiness is in CvBuildingInfo, not CvBuildingClassInfo. I haven't touched CvBuildingInfo yet, only the class. Should I edit the CvBuildingInfo section as well?

And is the nmake error related to this? If it isn't, the only thing I can think of is that I forgot to start with a clean copy of the SDK, and instead started editing the CvGameCoreDLL I copied from the BtS directory directly.
 
Well then could you post your code from CvInfos.cpp, the line 6323 and what's around it. Not the entire CvInfos but some code so that it's possible to see where your code is.
And the nmake error is most likely caused because of the other errors.
 
Yeah... I mixed CvBuildingClassInfo and CvBuildingInfo. Sorry about that...

But as NotSoGood said, the code will help a lot.
 
Well then could you post your code from CvInfos.cpp, the line 6323 and what's around it. Not the entire CvInfos but some code so that it's possible to see where your code is.
And the nmake error is most likely caused because of the other errors.

Spoiler :
Code:
void CvUnitClassInfo::setDefaultUnitIndex(int i)
{
	m_iDefaultUnitIndex = i;
}

bool CvUnitClassInfo::isUnique() const
{
	return m_bUnique;
}

bool CvUnitClassInfo::read(CvXMLLoadUtility* pXML)
{
	if (!CvInfoBase::read(pXML))
	{
		return false;
	}

	pXML->GetChildXmlValByName(&m_iMaxGlobalInstances, "iMaxGlobalInstances");
	pXML->GetChildXmlValByName(&m_iMaxTeamInstances, "iMaxTeamInstances");
	pXML->GetChildXmlValByName(&m_iMaxPlayerInstances, "iMaxPlayerInstances");
	pXML->GetChildXmlValByName(&m_iInstanceCostModifier, "iInstanceCostModifier");
	pXML->GetChildXmlValByName(&m_bUnique, "bUnique");

	CvString szTextVal;
	pXML->GetChildXmlValByName(szTextVal, "DefaultUnit");
	m_aszExtraXMLforPass3.push_back(szTextVal);

	return true;
}

He might not have any coding errors. He only did a build on the files, and you need to do a rebuild when making changes to the .h files.

Do a what now? Could you tell me how? Assume I'm a clueless berk with no prior coding experience whatsoever. (Because I am. :p)
 
Do a what now? Could you tell me how? Assume I'm a clueless berk with no prior coding experience whatsoever. (Because I am. :p)

Click "Rebuild Solution" instead of "Build Solution" in Visual Studio's Build menu. This will rebuild the entire DLL, including all header files.
 
Click "Rebuild Solution" instead of "Build Solution" in Visual Studio's Build menu. This will rebuild the entire DLL, including all header files.

I can't find "Rebuild Solution", and "Build Solution" is under the Debug menu. There is a Build toolbar however, with the buttons "Build CvGameCoreDLL" and "Build Solution". (I'm using M$ Visual C++ 2010 Express, which might explain the discrepancy.)
 
I can't find "Rebuild Solution", and "Build Solution" is under the Debug menu. There is a Build toolbar however, with the buttons "Build CvGameCoreDLL" and "Build Solution". (I'm using M$ Visual C++ 2010 Express, which might explain the discrepancy.)

You have Basic Settings enabled (it's enabled by default). Under Tools->Settings, change it to Advanced Settings to get the Build toolbar (and everything else hidden by default in the express edition).
 
Can you also post the place in CvInfos.h that you changed to add CvUnitClassInfo::isUnique()?
 
You have Basic Settings enabled (it's enabled by default). Under Tools->Settings, change it to Advanced Settings to get the Build toolbar (and everything else hidden by default in the express edition).

Thank you. Rebuilding.

Can you also post the place in CvInfos.h that you changed to add CvUnitClassInfo::isUnique()?

I can't find that exact string, but here's my CvUnitClassInfo anyway:

Spoiler :
Code:
class CvUnitClassInfo :
	public CvInfoBase
{
//---------------------------------------PUBLIC INTERFACE---------------------------------
public:

	CvUnitClassInfo();
	virtual ~CvUnitClassInfo();

	int getMaxGlobalInstances() const;				// Exposed to Python
	int getMaxTeamInstances() const;				// Exposed to Python
	int getMaxPlayerInstances() const;				// Exposed to Python
	int getInstanceCostModifier() const;				// Exposed to Python
	int getDefaultUnitIndex() const;				// Exposed to Python
	void setDefaultUnitIndex(int i);
	bool isUnique() const;

	bool read(CvXMLLoadUtility* pXML);
	bool readPass3();

//---------------------------------------PROTECTED MEMBER VARIABLES---------------------------------
protected:

	int m_iMaxGlobalInstances;	
	int m_iMaxTeamInstances;	
	int m_iMaxPlayerInstances;	
	int m_iInstanceCostModifier;
	int m_iDefaultUnitIndex;
	bool m_bUnique;


};
 
It compiles. Thank you all for the help. If I run into any further trouble, I'll be sure to come and bother you again :p
 
Back
Top Bottom