Jump to content
Snre3n

Source code - Undefined identifiers in MindPower3D

Recommended Posts

Hi,

I'm trying to build MindPower3D and I get an total of 144 C2065 build errors, all of them consist of either the variable ' n ', ' j ' or ' i '.   e.g.  ' i ' : undeclared identifier.

e.g. from source file:  l_Effect.cpp 

bool	I_Effect::SaveToFile(FILE* pFile)
{
....
....
 // 2. Decfine WORD n; here  
  
for(WORD n = 0; n < _wFrameCount; n++) 
	{
		fwrite(&_vecFrameTime[n],sizeof(float),1,pFile);
	}
	//!ÿһ֡´óС
	for( n = 0; n < _wFrameCount; n++)
	{
		fwrite(&_vecFrameSize[n],sizeof(D3DXVECTOR3),1,pFile);
	}
	//!ÿһ֡½Ç¶È
	for( n = 0; n < _wFrameCount; n++)
	{
		fwrite(&_vecFrameAngle[n],sizeof(D3DXVECTOR3),1,pFile);
	}
	//!ÿһ֡λÖÃ
	for( n = 0; n < _wFrameCount; n++)
	{
		fwrite(&_vecFramePos[n],sizeof(D3DXVECTOR3),1,pFile);
	}
	//!ÿһ֡ÑÕÉ«
	for( n = 0; n < _wFrameCount; n++)
	{
		fwrite(&_vecFrameColor[n],sizeof(D3DXCOLOR),1,pFile);
	}
  
.... 
....
  
  
}

1. Should I simply initialize them all to " WORD n = 0; " inside each for loop parameters?
2. Move the declaration of the variable ' n ' above the first for loop?  See code.

I have noted that these three variables occours very often, undeclared.  Are these "one letter variables" declared somewhere in a header file?
Another thought is if the C++ language standard has changed since the code was written to increase the type safety?

 

 

Share this post


Link to post
Share on other sites

Hello @Snre3n

 

Цитата

1. Should I simply initialize them all to " WORD n = 0; " inside each for loop parameters?
2. Move the declaration of the variable ' n ' above the first for loop?  See code.

You can use both ways. 

 

What version of VS are you using? Try to use VS 2008


Share this post


Link to post
Share on other sites

VS2015: need to manually fix that variables. Add WORD in every for-cycle.

for(WORD n = 0; n < _wFrameCount; n++)

Or(more likely) just create variable in function-scope:

WORD n = 0;

 

Share this post


Link to post
Share on other sites

If I don't get that wrong, do you mean that I can let VS2008 set the variable type for me, and with VS2015 I need to manually set it?

 

for( n = 0; n < _wFrameCount; n++)

Code above compiles fine with VS2008 but fails with VS2015?

 

Share this post


Link to post
Share on other sites

I think that's precisely it. There might be more differences though, but I hope not. Keep trying it with 2015 and tell us if you run into any other problems (better compatibility is better).

Edited by deguix

Share this post


Link to post
Share on other sites
21 hours ago, Snre3n said:

If I don't get that wrong, do you mean that I can let VS2008 set the variable type for me, and with VS2015 I need to manually set it?

 


for( n = 0; n < _wFrameCount; n++)

Code above compiles fine with VS2008 but fails with VS2015?

 

In VS2015 variable n doesnt exist after first loop is done so you have to redefine it.

for(WORD n = 0; n < _wFrameCount; n++)

 

Share this post


Link to post
Share on other sites

Hello all. With regards to MindPower3D, where are you getting the DX8 includes? I downloaded a folder from another project with all the .h and .cpps needed but I get for instance this (see screenshot):

 

Has anyone been able to compile this and the game client with VS2015?

error.jpg

Share this post


Link to post
Share on other sites

DX8 is included in the Common folder in 2.x files, download link can be found here in the Source Code.txt

As far I can tell, ID3DXEffect is part of Directx 9. ( https://msdn.microsoft.com/en-us/library/windows/desktop/bb205788(v=vs.85).aspx ).


I have "successfully" compiled both client and MindPower3D with VS2015 but in reality none of them seem to work when tested.
I'm far from experienced in C++ or any of the API's used to figure out what's wrong.

Share this post


Link to post
Share on other sites

You're right, includes are in v2.0 and seem to work, however I'm still not able to build it successfully in 2015. I've also tried 2008 and 2010, different errors here and there that won't resolve due to difference in compilers/assemblies. How were these projects made anyway? VS2003? 

Edited by s0crates

Share this post


Link to post
Share on other sites
5 hours ago, s0crates said:

You're right, includes are in v2.0 and seem to work, however I'm still not able to build it successfully in 2015. I've also tried 2008 and 2010, different errors here and there that won't resolve due to difference in compilers/assemblies. How were these projects made anyway? VS2003? 

You can see VS version in .sln file. Use VS2008 to compile without errors, but you have to rename MP to dr.

Share this post


Link to post
Share on other sites
7 hours ago, Wrexor said:

You can see VS version in .sln file. Use VS2008 to compile without errors, but you have to rename MP to dr.

 

That's why I asked if it's 2003. As per our previous conversation, I am trying to build MindPower3D (v1.3) which won't compile. VS quoted in sln is

"Microsoft Visual Studio Solution File, Format Version 8.00"

which means VS2003. This will NOT build with VS2008.

 

There are some standard things that need to be fixed in all solutions I've tried so far:

- Undeclared variables (n, i, j). Solution: move the "WORD n" from the for loop to the line on top of it so that it's valid for the scope. In some cases it's not declared at all, so do it yourself.

- char * error. Solution, put a cast (char *) after the assignment of the type it requires.

- fwrite with _Myfirst member error. Solution: in VS2015 I fixed this by calling _Myfirst() (parenthesis). In VS2008 this won't work as there was a breaking change from VS2003 to VS2005 and then another in VS2008.

 

Specifically, you will get an error like:

 

error C2248: 'std::vector<_Ty>::_Myfirst' : cannot access protected member declared in class 'std::vector<_Ty>'

 

which is due to: https://msdn.microsoft.com/en-us/library/tsbce2bh.aspx

 

This means the code is not 2008 (even not 2005) compliant, and will not compile. I don't know how these were "fixed", but they weren't. Have you actually compiled this yourself with VS2008 and no errors? (Note: I am talking about: Fixed Server Fiile\Files\Engine\sdk\proj\MindPower3D.sln)

 

I'm currently going to make an XP VM and install VS2003 to see how this goes, cause I'm done with installing VSes on this machine.

  • Like 2

Share this post


Link to post
Share on other sites

Hello @s0crates

 

Quote

 

error C2248: 'std::vector<_Ty>::_Myfirst' : cannot access protected member declared in class 'std::vector<_Ty>'

the error refers to this?

http://en.cppreference.com/w/cpp/container/vector/front // first

http://en.cppreference.com/w/cpp/container/vector/at // any by position

http://en.cppreference.com/w/cpp/container/vector/back // last

http://en.cppreference.com/w/cpp/container/vector/operator_at // ~ common array style

// c++11 pointer to raw array: ( but does not work for any kind of type, Ex: bool )

http://en.cppreference.com/w/cpp/container/vector/data

 

or just an internal incompatibility from the standard ?

 

* I'm not very strong at c++.

* I remember a few years ago that someone release a lot of very old toolchians to compile old code with VS2012+, that wont fix those errors, but you may able to compile it with a newer IDE, I'll try to find these later.

 


Discord: andresc

Share this post


Link to post
Share on other sites
46 minutes ago, Totoka said:

Hello @s0crates

 

the error refers to this?

http://en.cppreference.com/w/cpp/container/vector/front // first

http://en.cppreference.com/w/cpp/container/vector/at // any by position

http://en.cppreference.com/w/cpp/container/vector/back // last

http://en.cppreference.com/w/cpp/container/vector/operator_at // ~ common array style

// c++11 pointer to raw array: ( but does not work for any kind of type, Ex: bool )

http://en.cppreference.com/w/cpp/container/vector/data

 

or just an internal incompatibility from the standard ?

 

* I'm not very strong at c++.

* I remember a few years ago that someone release a lot of very old toolchians to compile old code with VS2012+, that wont fix those errors, but you may able to compile it with a newer IDE, I'll try to find these later.

 

 

Hi @Totoka. It's possible, however I have discarded my VS2008 installation so I can't verify if .front would work in the same way. Looking at the vector definition in my current VS2003 installation however, it appears _Myfirst is declared public, which would work as opposed to protected in VS2008. 

 

public:
	pointer _Myfirst;	// pointer to beginning of array

the referencing code being: (MPParticleSys.cpp)

fwrite(_vecPointRange._Myfirst,sizeof(D3DXVECTOR3),_wVecNum,t_pFile);

It's worth noting that there are two MindPower3D slns. Engine\MindPower3d.sln and Engine\sdk\proj\MindPower3d.sln

I'm trying the second one. Opening the client solution FILE\Client\Client\proj loads up the MindPower3d project as well that yields the same errors. 

EDIT: With VS2003 I was able to build everything with no errors, using the original server files (not the fixed ones)

Edited by s0crates
  • Like 1

Share this post


Link to post
Share on other sites
12 minutes ago, s0crates said:

@KONG

 

1. in the Source Code.txt that gives links to the source code:

 

 

Perhaps there's something I don't understand, but it says 1.3? I don't know the specifics but I see 1.3, so I refer to it as 1.3

 

2. I questioned noone's integrity. Vector suggested trying 2008, Wrex said to check the sln files to see the VS version. As I said before, this was pointing to 2003. Why are we still talking about this?

1. It says 1.3x because it was said so by files seller, actually its 2.x beta.

 

2. "1.3x" source does use VS 2003. I thought you were using "2.4" thats why I said VS2008.

Share this post


Link to post
Share on other sites

I have remove all posts that will lead to future offtopics. I will also include the following details to prevent future confusion: 

the src being worked here is "1.3" from the download, known as 2.0 IDK if @s0crates is the OP, and if we are all discussing the same version so I'll advice to include the src version next time to avoid confusion.


kong.png

a2.png

Share this post


Link to post
Share on other sites
23 minutes ago, Totoka said:

 

@KONG, that hidden post was also offtopic ? I thought it wasn't

Sure, you went off topic to a certain degree. But you did not quote the whole post but bits and pieces. Also the original topic discusses syntax changes of "for" loops. Totoka, I am tired of coming to this thread not discussing what the thread is meant for, if you feel your post follows thread topic, you are a community and feel free to change it. 


kong.png

a2.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...