| | |
Heres a hard one: ostream include / msvcp90d.dll not working
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jun 2009
Posts: 6
Reputation:
Solved Threads: 0
So I was coding along working on another dll, I recompiled a dll containing the following code and suddenly my program was crashing, when i clicked the show info link on the 'send this report to Microsoft' dialog box, it said the dll which was throwing the error was msvcp90d.dll, I tracked it down to the log function (debigger said it couldn't be evaluated) :
So I decided to try something, the logger started below is logged correctly, but log still crashes.
So I thought there might be some strange issue with the logfile object's access or something so I tried below:
Now this is where it gets freaky, now the debugger jumps into the ostream header and says the following is not evaluating (in bold):
Line 746:
And um well now I'm just confused >.< and would like my program to run correctly again...
C++ Syntax (Toggle Plain Text)
#include "log.h" (includes <iostream>, <fstream>, <string> and has the log structure) RupLogger::RupLogger() { logfile.open("log.txt", ios::out); } RupLogger::~RupLogger() { logfile.close(); } void RupLogger::log(string msg) { logfile << msg + " \n"; }
So I decided to try something, the logger started below is logged correctly, but log still crashes.
C++ Syntax (Toggle Plain Text)
RupLogger::RupLogger() { logfile.open("log.txt", ios::out); logfile << "[SYS] Logger Started \n"; }
So I thought there might be some strange issue with the logfile object's access or something so I tried below:
C++ Syntax (Toggle Plain Text)
void RupLogger::log(string msg) { this->logfile << "[SYS] Test Log \n"; this->logfile << msg + " \n"; }
Now this is where it gets freaky, now the debugger jumps into the ostream header and says the following is not evaluating (in bold):
Line 746:
streamsize _Pad = _Ostr.width() <= 0 || _Ostr.width() <= _Count ? 0 : _Ostr.width() - _Count;
And um well now I'm just confused >.< and would like my program to run correctly again...
Well i copied your class, created a class definition out of whatever was given and used it and it worked fine for me.
Don't see any reason why it should crash. Could it be something else causing the crash. Did you check the core file?
c++ Syntax (Toggle Plain Text)
#include <iostream> #include <fstream> #include <string> class RupLogger { public: RupLogger(); ~RupLogger(); void log(std::string msg); std::ofstream logfile; }; RupLogger::RupLogger() { logfile.open("log.txt", std::ios::out); } RupLogger::~RupLogger() { logfile.close(); } void RupLogger::log(std::string msg) { logfile << (msg + " \n"); } int main() { RupLogger().log("Hi there"); }
Don't see any reason why it should crash. Could it be something else causing the crash. Did you check the core file?
thanks
-chandra
-chandra
•
•
Join Date: Jun 2009
Posts: 6
Reputation:
Solved Threads: 0
Yea both ostream and the dll haven't been modified for months, and compiled and ran just fine a little while ago, what I don't get is why I'm getting the debug error inside of the ostream header file.
I am calling log through a pointer of the class, but it's been initialized and had it's constructor called before hand, besides if I put other functions in the log function it still runs correctly till it tries to write a line.
I am calling log through a pointer of the class, but it's been initialized and had it's constructor called before hand, besides if I put other functions in the log function it still runs correctly till it tries to write a line.
Last edited by mOoEyThEcOw; Jun 26th, 2009 at 5:51 am.
•
•
Join Date: Jun 2009
Posts: 6
Reputation:
Solved Threads: 0
This is the code that crashes it and how it is being called. Now I'm kinda new but as far as I know I'm doing that right.
c++ Syntax (Toggle Plain Text)
#include <iostream> #include <fstream> #include <string> class RupLogger { public: RupLogger(); ~RupLogger(); void log(std::string msg); std::ofstream logfile; }; RupLogger::RupLogger() { logfile.open("log.txt", std::ios::out); } RupLogger::~RupLogger() { logfile.close(); } void RupLogger::log(std::string msg) { logfile << (msg + " \n"); } static RupLogger* iLog; int main() { iLog = &RupLogger(); iLog->log("Hi there"); }
Last edited by mOoEyThEcOw; Jun 26th, 2009 at 6:30 am.
Temporary object. Use new keyword.
C++ Syntax (Toggle Plain Text)
iLog =new RupLogger();
Failure is not fatal, but failure to change might be. - John Wooden
![]() |
Similar Threads
- Setting up a 2nd hard drive (Windows NT / 2000 / XP)
- Browser keeps opening on its own (Viruses, Spyware and other Nasties)
- Hijackthis report, I just don't know (Viruses, Spyware and other Nasties)
- yyy65&XBDYUS.htm annoyance!!!! (Viruses, Spyware and other Nasties)
- Need Help With Hacktool Rootkit (Viruses, Spyware and other Nasties)
- i think my computer is infected (Viruses, Spyware and other Nasties)
- I got some problems once again. (Viruses, Spyware and other Nasties)
- how to include a .so file in c++ dll? (Java)
- datadx.dll (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: Z-Buffer (depth Buffer) implementation
- Next Thread: help with recursion and iterative pls
| Thread Tools | Search this Thread |
api array based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






