# Works on 98 but not on XP?

This topic is 4205 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm currently working on a little game. Well, actually only the GUI's really intact right now. Anyways, it compiles and runs absolutely perfect for me... but whenever I pass it to a friend who has say, Windows XP installed it pukes. And of course since I don't have XP installed, I can't really go around debugging this on my own.
int main(int argc, char** argv)
{
#ifdef _DEBUG_CLIENT_
if(argc>1)
{
if(!strcmp(argv[1],"debug-mode"))
{
error->Debug = true;
}
}
#endif
error->Write("Initializing GLUT...");

That Write at the bottom was a part of others I implemented to see where it was puking for my friend. The thing is, when he ran it the error.txt was created... but nothing got written in it.
void DebugIO::Write(const char* output)
{
if (!isOpen)Open();
fprintf(stderr,"%s",output);
}

The Open function basically just redirects stderr to "error.txt", sets the "isOpen" bool to true, and outputs the date (which wasn't even shown). Now is there any difference in possible .DLL's and such that 98 and XP have that would cause a crash using these certain functions? Because like I said it compiles fine, no warning and whatnot, runs perfectly fine except on XP. Any and all help is appreciated. :) -Etyrn

##### Share on other sites
(This could be off base, so take it for what it is)

A few of my books say that programs running on Windows XP can not write into any other folder except My Documents by default - and this is the standard option on XP Home Edition. There are some special function calls which facilitate writing to the appropriate place.
Personally, I've never had a problem with it, but it may be what you're encountering.

Cheers,
--Brian

##### Share on other sites
That'd make sense, but I'm pretty sure that's not it. Since it *used* to write properly. The only change I made to the DebugIO class was that I added if(!isOpen)Open(); to the Write function so I didn't have to do
if(!error->isOpen)error->Open();
error->Write("");
in main or whatever other function would call "Write". I don't really see how that'd screw it over, though.

-Etyrn

##### Share on other sites
This may not help but you could try calling "fflush(FILE *);" after every write to the file, i'm not sure if the buffer would be flushed when your program crashes.

Sorry I don't have anything else to offer.

##### Share on other sites
Quote:
 Original post by Nairb(This could be off base, so take it for what it is)A few of my books say that programs running on Windows XP can not write into any other folder except My Documents by default - and this is the standard option on XP Home Edition. There are some special function calls which facilitate writing to the appropriate place.Personally, I've never had a problem with it, but it may be what you're encountering.Cheers,--Brian

I thought the rule was just that no program is allowed to write anywhere within "Program Files" (or any system folders and such).

##### Share on other sites
Quote:
 Original post by Smacker_626This may not help but you could try calling "fflush(FILE *);" after every write to the file, i'm not sure if the buffer would be flushed when your program crashes.

I also go to the trouble with my "catch a crash" log files of closing and re-opening the file for each write, since I've had problems in the past where flushing did not get everything written to disk due to lazy write I/O in the O/S.

Also, you might consider looking into setting up some alternate O/S virtual machines so that you can at least test on a "modern" version of Windows like 2K. You can do this for free (sans nominal ebay O/S price) with the free VMware Player and a bit of googling to figure out how to manually modify the config files and to get VMware Tools to install.

##### Share on other sites
Does this run on another computer with 98 on it? I'd have to guess that you need to redistribute files(probably .dlls) that you aren't aware of and that it won't work on *any* other computer. And what compiler are you using?

##### Share on other sites
Alright!

I tried the fflush, didn't work. Nice idea, though.
As for "not sending everything" my linker has:
-lglut32
-lglu32
-lopengl32
-lwinmm
-lwsock32

And I'm pretty sure out of that the only .DLL I'd need to send is glut32.dll, which I did. Also sent my full graphics folder, but I have self handled errors to test with that. As soon as I get access to another 98 SE computer I'll try there, too. As for my compiler I'm using Dev-C++.

And everyone, thanks for your help. :)

-Etyrn

##### Share on other sites
Windows XP is a lot more fussy than 98 about accessing invalid memory addresses etc. I was working on a platform game a while back on 98 (using devcpp too), and it worked fine, but then I upgraded to XP and it crashed immediately when I ran it. It took me ages to track down all the bugs and get it running in XP. If you are sure that you are including all the necessary DLLs, you should double check your pointer initializations. If at all possible, try to get your friend to let you have a debugging session on XP :D

##### Share on other sites
Aye, I had a feeling it'd come to this. Though the friend mentioned I don't actually know irl... >_> I can always do it on my Dad's uber duber debuggin' compooter, though. Thanks!

-Etyrn

##### Share on other sites
Okay... kinda fixed. Well, I fixed the error problem by not initializing it as a pointer and of course taking out the '->' operator. But now there's a new error, that makes absolutely *no* sense whatsoever.

Here's the deal...
error.Write("5.");   getWindow(WIN_TEST)->CreatecButton(100,161,100,29,"Button",WIN_TEST);   getWindow(WIN_TEST2)->CreatecButton(50,61,100,29,"Button",WIN_TEST2);

getWindow returns a window pointer. I believe it's at getWindow where the problem occurs, as it has troubles getting the window then uses the '->' operator with an invalid pointer. WIN_TEST and WIN_TEST2 are defined as 2 and 3 respectively (already tried tossing 2 and 3 without using the names). And here's the get window function...
cWindow* cGUI::getWindow(int id){   error.Write("1..");   for(vWit = vWindow.begin();vWit!=vWindow.end();vWit++)   {      error.WriteInt((*vWit)->ID);error.WriteInt(id);      if((*vWit)->ID == id)         return (*vWit);   }error.Write("..2");}
I added those error writes to see what exactly was going on... here's the output for me and my friend.
Mine:
1..224561..23334561..2231..233336.
1.. starting loop, 22 iterator and arguement ID match! Return the window and create a button for it.(4561~ so on are just more checks I made, obsolete atm).
Friends:
1..332332..245
1.. starting loop, 33 iterator and arguement ID match! But wait a tick, those aren't the arguements I passed! And even though they match, the loop continues... next time the window's ID is 2, arguement ID remains 3... then loops again, and window's ID is 3, and the arguement that I passed has changed to "2"! What the fork? Then ..2 indicates loop ended, no window found and therefore none returned. Then 45 and CRASH.

Anyone have any clue as to what on Earth is going on? O_o

-Etyrn

[Edited by - Etyrn on June 12, 2006 6:00:27 PM]

##### Share on other sites
I had this same problem. :/ What a cruel world.

##### Share on other sites

This topic is 4205 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.