[Help] errors, despite following guids and experimenting

Newbie Spellweaver
Joined
Dec 21, 2008
Messages
6
Reaction score
0
hello guys, this is my first post here, i just need some help. i already look at guides and follwed them perfectly, i also searched the forums for answers as well as experimented fixes myself, but all at a loss D:

i dont knwo what to do anymore so now i turn to you guys :]

im using that dragon source server and everything works fine except for compiling gameserver.

i get these errors, i know they r posted in this forum and i did fixes from other threads but i dont know why im still gettin them :/

heres error 1
Code:
c:\documents and settings\alexander\desktop\keybind\dragonflyff_source\gameserver\MersenneTwister.h(190) : error C2661: 'fopen' : no overloaded function takes 2 arguments
c:\documents and settings\alexander\desktop\keybind\dragonflyff_source\gameserver\MersenneTwister.h(197) : warning C4800: 'size_t' : forcing value to bool 'true' or 'false' (performance warning)
and the code from MersenneTwister.h
Code:
	FILE* urandom = fopen( "/dev/urandom", "rb" );

and heres error 2.
Code:
c:\documents and settings\alexander\desktop\keybind\dragonflyff_source\gameserver\Config.h(202) : error C2770: invalid explicit template argument(s) for 'T ConfigFile::string_as_T(const std::string &)'
        c:\documents and settings\alexander\desktop\keybind\dragonflyff_source\gameserver\Config.h(102) : see declaration of 'ConfigFile::string_as_T'
        .\Server.cpp(130) : see reference to function template instantiation 'bool ConfigFile::readInto<char[50]>(T (&),const std::string &) const' being compiled
        with
        [
            T=char [50]
        ]

and the code from server.cpp
Code:
void WINAPI Server::worldServerThread(){
loop:
	worldServerSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
	if(worldServerSock!=INVALID_SOCKET){
		char serverip[50];
		config.readInto(serverip, "ip");
		if(connectToWorldServer("127.0.0.1",23000)){
			char servername[50];
			config.readInto(servername, "servername");
			sendWorldServerAuth("Game-Proz");
			fd_set fds;
			do {
				FD_ZERO(&fds);
				FD_SET (worldServerSock, &fds);
				int Select = select(worldServerSock+1,&fds,NULL,NULL,NULL);
				if(Select == SOCKET_ERROR) {
					setIsActive(false);
				} else {
					if(FD_ISSET(worldServerSock,&fds)) {
						//if(!WSAMain::recvData())
							//WSAMain::setIsActive(false);
					}
				}
				Sleep(1);
			} while(getIsActive());
		}
	}
	Sleep(100);
	goto loop;
}
if someone could explain whats goin on and how to resolve this it would be much appreaciated. im learning so much so far :D
 
Re: errors, despite following guids and experimenting

error 1: what did you do to make your line 265 go to 190? Redownload source(or take from .rar if you have) and take the file again.
error 2: Coment out/delete "config.readInto(" lines.
 
Re: errors, despite following guids and experimenting

thanks for the reply, i tried a fresh version of MersenneTwister.h, but now im gettin these annoyances.. :/

Code:
c:\documents and settings\alexander\desktop\keybind\dragonflyff_source\gameserver\MersenneTwister.h(132) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
c:\documents and settings\alexander\desktop\keybind\dragonflyff_source\gameserver\MersenneTwister.h(265) : error C2661: 'fopen' : no overloaded function takes 2 arguments

heres whats on those lines.

132
Code:
		{ return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL); }
265
Code:
	FILE* urandom = fopen( "/dev/urandom", "rb" );
 
Re: errors, despite following guids and experimenting

thanks for the reply, i tried a fresh version of MersenneTwister.h, but now im gettin these annoyances.. :/

Code:
c:\documents and settings\alexander\desktop\keybind\dragonflyff_source\gameserver\MersenneTwister.h(132) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
c:\documents and settings\alexander\desktop\keybind\dragonflyff_source\gameserver\MersenneTwister.h(265) : error C2661: 'fopen' : no overloaded function takes 2 arguments

heres whats on those lines.

132
Code:
		{ return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL); }
265
Code:
	FILE* urandom = fopen( "/dev/urandom", "rb" );

line 132 is just a warning, it will still work.
line 265 I really dont know. works fine for me.
 
Re: errors, despite following guids and experimenting

yah i know its just a warning, i stilll hate warnings though :P

as for the actual error, is there any ideas on wut can be done? im really blocked here, nothing else can be done till i fix this..

Code:
c:\documents and settings\alexander\desktop\keybind\dragonflyff_source\gameserver\MersenneTwister.h(265) : error C2661: 'fopen' : no overloaded function takes 2 arguments

anything u know to do with fopen or seomthing? :/
 
Re: errors, despite following guids and experimenting

yah i know its just a warning, i stilll hate warnings though :P

as for the actual error, is there any ideas on wut can be done? im really blocked here, nothing else can be done till i fix this..

Code:
c:\documents and settings\alexander\desktop\keybind\dragonflyff_source\gameserver\MersenneTwister.h(265) : error C2661: 'fopen' : no overloaded function takes 2 arguments

anything u know to do with fopen or seomthing? :/

I didnt see the use of that(MersenneTwister.h) anywhere, and, last time I saw that name it was a random number generator.
So, unless you are using it, comment the call of the header and it would be just fine.
 
Re: errors, despite following guids and experimenting

well, it kinda is being used by swarm.cpp as a random number generator for a function that is used in many other files...
:/

edit:
Code:
FILE* urandom = fopen( "/dev/urandom", "rb" );

that dir. "/dev/urandom" doesnt exist anywhere on my computer.. were can i get it?
 
Re: errors, despite following guids and experimenting

hey again, i know this is the 3rd post in a row, but its been quite a few days now and i still have just this one problem, its the only problem im getting and i cant finish what i have been doing until i fix this... I've done countless searching and tutorials online but i just cannot solve this problem, if anyone at all can help me out just a little bit on this it would be greatly appreciated, thanks and again, sorry for this triple post.
 
Re: errors, despite following guids and experimenting



I suppose the function try to access to linux repertory but if it can't (probably in windows) it use clock

:
Code:
FILE* urandom = fopen( "/dev/urandom", "rb" );
	if( urandom )
	{
		uint32 bigSeed[N];
		register uint32 *s = bigSeed;
		register int i = N;
		register bool success = true;
		while( success && i-- )
			success = fread( s++, sizeof(uint32), 1, urandom )?1:0;
		fclose(urandom);
		if( success ) { seed( bigSeed, N );  return; }
	}
	
	// Was not successful, so use time() and clock() instead
	seed( hash( time(NULL), clock() ) );

Do you tried to bypass it ?

Code:
[b]/*[/b]
FILE* urandom = fopen( "/dev/urandom", "rb" );
	if( urandom )
	{
		uint32 bigSeed[N];
		register uint32 *s = bigSeed;
		register int i = N;
		register bool success = true;
		while( success && i-- )
			success = fread( s++, sizeof(uint32), 1, urandom )?1:0;
		fclose(urandom);
		if( success ) { seed( bigSeed, N );  return; }
	}
	[b]*/[/b]
	// Was not successful, so use time() and clock() instead
	seed( hash( time(NULL), clock() ) );

I(m on holiday and just beginner in C++ so i haven't try myself, just offer an idea ^^

I suppose your mistake is because fopen don't understand this part : "/dev/urandom"
Perhap i make myself a mistake but on windows (you're in local mode) a correct path should be like : \myrepertory\myfile.txt perhaps it generat an error when you're compiled it...

In all case, if you bypass this part the function use the clock() instead so...it should work...
 
Back