Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / help writing to a file

Author
Message
The Black Knight
16
Years of Service
User Offline
Joined: 29th Feb 2008
Location:
Posted: 5th Mar 2008 04:29
I'm not sure what im doing wrong here.

Here is the debug error i get.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 5th Mar 2008 18:01
The same problem I mentioned in another thread yesterday, albeit not exactly the same problem the OP was bringing up. As it was, the solution he was given (essentially linking to the mutli-threading model) didn't work for me, mostly because I already had the /MTd option set. Once I changed it to something else and set it back I couldn't compile without getting the same error anyway. I had to revert back to a copy of the entire project I keep on a thumb drive.

The problem seems to be in the inclusion of <fstream>. The other poster had problems with <string>. I'm guessing there's some sort of conflict with the way the GDK handles things but for the life of me I can't figure out exactly what it might be other than a consistent effect on some of the standard libraries. Mostly it seems to involve the standard C library functions dealing with memory allocation. This only seems to occur in a Debug build.

I don't get the same errors when I switch to a Release build. When I merely add the reference to <fstream> the Release build goes through. But I need to either fully qualify the instance as std::ofstream or specify "using namespace std;" in the program.

My guess? Either something that GDK doesn't account for in a debug build or a problem with the debug library for VS 2008.

Lilith, Night Butterfly
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 5th Mar 2008 18:16
Quick followup.

I tried a quick test in VS 2008 on a standard Win 32 program and couldn't get the same error in a Debug build. So I have to assume that it involves something that the GDK introduces.

For my current project this probably isn't going to be much of a problem since debugging file writes won't be unworkable without debug mode. But the followup program will require that I read in the data from my current program first and debugging will be necessary following that.

I considered using mem blocks but it will add to my ramp up time and the thought of using a DWORD as a pointer gives me the willies. Maybe I'll use mem blocks in the next project and just finish off my current one with <fstream> in Release mode.

Lilith, Night Butterfly
The Black Knight
16
Years of Service
User Offline
Joined: 29th Feb 2008
Location:
Posted: 5th Mar 2008 19:13
I found how to fix this you go to project open properties click the + by Configuration Properties click the + by C/C++ open Code Generation and change runtime library to Multi-threaded (/MT)
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 6th Mar 2008 19:57
I came across that eventually too, though for some reason it didn't fix the problem initially but has now. Now the problem, a minor one for sure, is that if I do file access I seem to generate an unhandled exception on exiting the program. Again, this doesn't happen in release mode and is only a minor issue in debugging. But I may have to throw a catch-all try around the program to get some idea of what it is and work on it before releasing it.

Lilith, Night Butterfly

Login to post a reply

Server time is: 2024-11-20 05:45:11
Your offset time is: 2024-11-20 05:45:11