|
The order of #include's may matter. Which do you include first? "stdafx.h" or <fstream> ?
Maxwell Chen
|
|
|
|
|
stdafx.h is before fstream
|
|
|
|
|
|
As the problem is only in debug mode, maybe there is something wrong with some preprocessor definition. If you have a #ifdef _DEBUG statement at the top of your file, post it here (completely) so we can have a look.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
ok, ive tried without the #ifdef _DEBUG
#include "stdafx.h"
#include "resource.h"
#include "Dialog1.h"
#include "Dialog2.h"
#include "assert.h"
#include <Windows.h>
#include "Dialog3.h"
#include <io.h>
#include <fcntl.h> /* Needed only for _O_RDWR definition */
#include <share.h>
#include <stdio.h>
#include "EmbeddedDialogDlg.h"
#include "QuickMissLoadWriteEdit.h"
#include <iostream>
#include "string.h"
#include <string>
#include <fstream>
using namespace std;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
code comes here
|
|
|
|
|
Mmmh, I don't see really the problem here. Anyway, you are mixing deprecated header files with new ones. Remove all the include with a .h for the stadard library (stdio,io,string). I don't think this will solve the problem but check that first.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
ok, thanks anyway
|
|
|
|
|
FredrickNorge wrote: #include <assert.h>
#include <Windows.h>
#include <io.h>
#include <fcntl.h> /* Needed only for _O_RDWR definition */
#include <share.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <fstream>
Why don't you have these in the stdafx.h file?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
FredrickNorge wrote: vs2005, when i want to debug my mfc app with #include fstream
FredrickNorge wrote: 1>C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\xdebug(32)
Generally speaking, in a MFC/VS2005 project of Debug configuration, the version of operator new being invoked is:
"afxmem.cpp" line 59,
void* __cdecl operator new(size_t nSize, LPCSTR lpszFileName, int nLine)
{
return ::operator new(nSize, _NORMAL_BLOCK, lpszFileName, nLine);
}
And then "afxmem.cpp" line 393,
void* __cdecl operator new(size_t nSize, int nType, LPCSTR lpszFileName, int nLine)
{
#ifdef _AFX_NO_DEBUG_CRT
UNUSED_ALWAYS(nType);
UNUSED_ALWAYS(lpszFileName);
UNUSED_ALWAYS(nLine);
return ::operator new(nSize);
#else
void* pResult;
#ifdef _AFXDLL
_PNH pfnNewHandler = _pfnUninitialized;
#endif
for (;;)
{
pResult = _malloc_dbg(nSize, nType, lpszFileName, nLine);
if (pResult != NULL)
return pResult;
#ifdef _AFXDLL
if (pfnNewHandler == _pfnUninitialized)
{
AFX_MODULE_THREAD_STATE* pState = AfxGetModuleThreadState();
pfnNewHandler = pState->m_pfnNewHandler;
}
if (pfnNewHandler == NULL || (*pfnNewHandler)(nSize) == 0)
break;
#else
if (_afxNewHandler == NULL || (*_afxNewHandler)(nSize) == 0)
break;
#endif
}
return pResult;
#endif
}
Maxwell Chen
-- modified at 14:01 Tuesday 18th July, 2006
|
|
|
|
|
ok i tried to overide the calls, no luck .
What ive done for now though, is commented the verry brief code that actualy use fstream when i debug, and uncomment it for the final release. Works ok for now...
|
|
|
|
|
For this kind of problem, sometimes looking at the compilation log message may help. For example when you have such compilation output message as below:
Compiling ...
stdafx.cpp
test1.cpp
test2.cpp
test3.cpp
e:\wrkshp\test3.cpp(102) : error Cxxxx: blah blah blah
test4.cpp
test5.cpp
Test - 1 error(s), 0 warning(s)
Then you may try to back trace those existing definitions by looking at the included headers (and the related compilation units) in the last compilation (eg: test3.cpp) unit wherein errors are found.
Maxwell Chen
|
|
|
|
|
will do, thanks for all the inputt Maxwell Chen
|
|
|
|
|
Does anyone out there have any suggestiosn on what it the best way to move existing (unmanaged) C++ code into CLR? is it best to port it to C# or is it easier to convert it into "managed" C++ so that the classes becomes available in other languages?
Anil Gurnani
Bear Stearns
|
|
|
|
|
One purpose of MC++ ( C++/CLI ) is the easy porting of C++ code to .NET
|
|
|
|
|
I am building a customized CFileDialog and I have a couple of questions.
1) How do I clear the filename history of the CFileDialog. When my application comes up and I click on the folder to bring up the dialog, the history box is full of files even though I have not entered anything yet. I would like to clear it out prior to creating the CFileDialog.
2) How do I implement the help file for the
Z.K.
|
|
|
|
|
Z.K. wrote: 1) How do I clear the filename history of the CFileDialog. When my application comes up and I click on the folder to bring up the dialog, the history box is full of files even though I have not entered anything yet. I would like to clear it out prior to creating the CFileDialog.
The entries are stored in the registry.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Can someone explain to me how I get my dialog to repaint itself after I draw text on it via the CDC::TextOut command?
Here is my code that I am using for drawing the text.....
CFont Smaller_font;
Smaller_font.CreateFont(40,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,ANSI_CHARSET,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DECORATIVE, "Arial");
def_font = dc.SelectObject(&Smaller_font);
dc.SetTextColor(COLORREF RGB(0,0,0));
dc.TextOut(150, 130, "Thank you.");
Smaller_font.DeleteObject();
This draws the "Thanks you" where I tell it, but if I have the program running and another window covers up the "Thank you." that I just drew, it erases it from my dialog. I am thinking that it is not forcing the repaint command somehow, but I am not sure how to force it.
Please help....
|
|
|
|
|
do your painting in the dialog's OnPaint member function.
Do the chickens have large talons?
|
|
|
|
|
Where is this code ? is in the OnPaint function of the dialog ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
No, it's not in the OnPaint function.
I am drawing text on the screen at different parts of the program, after the user clicks certain buttons.
|
|
|
|
|
Well, that's your problem. When the user clicks to trigger a draw, you need to modify some state data in your object. The OnPaint should then interpret what that data means, and provide an up-to-date set of paint operations.
To trigger the repaint, invalidate your window.
Steve S
Developer for hire
|
|
|
|
|
I think I understand what you mean, but let me check.
In the OnPaint() command of my dlg class, I need to have it check to see if, say a boolean value is true? If so, then do what?
Also, what do you mean by... "To trigger the repaint, invalidate your window"
|
|
|
|
|
why you dont use these function in wm_paint
whitesky
|
|
|
|
|
what do you mean by this?
I have tried...
PostMessage(WMPAINT,0,0), but that didn't work either.
|
|
|
|
|
Move your drawing logic to the handler for the WM_PAINT message. Windows will send this message to your dialog when necessary.
To force a repaint (uncommon), call Invalidate() .
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|