|
This article should be of help Surviving the Release Version[^]
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
You might not know this, but if you build release with pdb files (debug information) you can actually debug (with some limitations like optimized code etc.) your release build. This way you can at least find where in your program that fault occurs.
|
|
|
|
|
One classic reason for this is to define a ON_MESSAGE handler incorrectly. The prototype for the ON_MESSAGE hander is:
afx_msg long OnMyMessage(WPARAM wParam, LPARAM lParam);
But, if you define it like this:
afx_msg void OnMyMessage(WPARAM wParam, LPARAM lParam);
It will work fine in debug mode and crash in release mode. You get no warnings and it can be very, very hard to debug (because it works in debug mode). This one has got me before. It took about 2 days to figure it out.
Hope this helps...
Jonathan Craig
www.mcw-tech.com
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
I've got an one-dimensional array of an picture.
I know the dimensions of the pic.
int x_dim=348;
int y_dim=256;
unsigend char *mypic;
mypic = new unsinged char[x_dim*y_dim];
//now i get a pic from a cam that writes into mypic values betwenn 0(black)
and 255(white)
CBitmap pic;
How to create a CBitmap out of this
Thanks Heiko
|
|
|
|
|
At first create a HBITMAP -> MSDN "CreateBitmap"
with you can create a CBitmap
Try this @ home. (B&B)
|
|
|
|
|
A little bit of code would be helpful
I've tried many things without succes.
Heiko
|
|
|
|
|
Create a bitmap of the correct size and call SetBitmapBits(). See ::SetBitmapBits or CBitmap::SetBitmapBits in the doc.
onwards and upwards...
|
|
|
|
|
Or just pass all params in the CBitmap::CreateBitmap method...
onwards and upwards...
|
|
|
|
|
I've tried the way you say but it doesn't work
CBitmap pic;
pic.CreateBitmap( 348, 256, 1, 1, NULL);
pic.SetBitmapBits( 348*256,mypic );
why this doesn't work. The pic seemed to be "randomly"
I,ve written an routine to save the data as bitmap. This works fine. the bitmap looks right.
what is my failure?
Heiko
|
|
|
|
|
In your CreateBitmap call, shouldn't the nBitcount parameter be 8?
onwards and upwards...
|
|
|
|
|
Could be,
I will try tomorrow.
I've got an cam which makes about 15 pics per second and i want to display it. (so it is not possible to save it into a file first)
I think if tried the parameter 8 for bBitcount but i'm not sure.
Many thanks for now
I will ask again tomorrow in a new thread if it doesn't work
Heiko
|
|
|
|
|
Hi,
I recently upgraded from VS 6.0 to VS.net 2002 (both enterprise edition), and now I get a error I can't seem to get rid of while compiling.
I have a pretty large array in my MFC project ( defined CString strScore[18][12][50]), in a seperate file, which I include where needed. The array is there to provide return data in a table lookup, (if I'm making sense now
On VS 6, I had to set compiler option /Zm300 to get the compile to go through, but this doesn't work now. I have tried /Zm2000 without result. I'm running on 512 MB RAM, with plenty of hard-drive space for the swap file, and I'm basically now sure how I'm supposed to get this to work.
------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
|
|
|
|
|
At first I thought you were using more than 2GB but 18 * 12* 50 * 256 is only about 2 MB so I can't see what your problem is... What does the /Zm300 do?
John
|
|
|
|
|
According to VS documentation, the default number here is 100 in the formula /Zmnumber, where number is, to quote MS: "A scaling factor that determines the compiler's memory allocation limit".
Having looked a little closer at the documentation, the greater the number is, the more memory is needed during comilation... I think my problem might be here, but not sure, and I don't know why I still have to increase the number dramatically after upgrading.
If anyone can shead som light on my problem, I am happy to hear from you!
------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
|
|
|
|
|
So you are saying that this error occurs during the compile? I thought we were talking about an exception because heap space is where CString is stored dynamically in memory. This is not allocated statically so there should be no compile error for that... I don't see why creating 18 * 12 * 50 CStrings will be a problem.
John
|
|
|
|
|
|
c1xx : fatal error C1060: compiler is out of heap space
This error comes up four times, with four diffrent files. As far as I can see, this has something to do with #includes.
------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
|
|
|
|
|
Hm... did you actually set a high swap file size?
according to the docs, a *high* /Zm makes sense
Does it get better with moving headers to/from stdafx.h?
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Well, win xp pro is telling me that total size of all paging files is 3068 MB, so I'm assuming that it's not a problem. Windows manages the size of those files and I got *plenty* of disk space, so I think I should be covered there...;P
I tried to move the file tables.h (with the array) to stdafx.h, but seemingly to help. stdafx.cpp compiled, after a long while, without reporting any problems, but all the other source files reported the same error.
|
|
|
|
|
You do declare the array as "extern CString yadda[][][], do you?
Can you, just for a test, reduce the CString array to [1][1][1], or even better, declare as
typedef CString[b][c] CStringMatrix;
extern CStringMatrix * array;
and instantiate it as
CStringMatrix * array = new CStringMatrix[a];
this should change nothing syntactically when using accessing the array, but moves it to the heap.
Just to see if the array is really the culprit
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Actually, being the newbie that I am, I didn't use extern, but it doesn't seem to make a diffrence in itself.
I tried to experiment with which number I could use with /Zm. I get "out of heap space" at about 128, while setting the value to default, 127, gives "fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit".
I tried to use extern CString yadda[1][1][1], which worked out quite OK, actually, as long as I didn't exceed 127...
Now, It seems the real question is: isn't a little below 3GB large enough swap file?
|
|
|
|
|
OldViking wrote:
I didn't use extern, but it doesn't seem to make a diffrence in itself
But it definitely does (maybe not for your problem, but in terms of C++)
if you use
int x;
in a header file, every .cpp that includes it gets it's own instance of x. To get a "truly global" x, you need to declare
extern int x;
in the header file, and
int x = 0;
(or any other initializer value) in one .cpp file.
On the main topic, I'm out of ideas. might be this *is* a problem with the compiler. The only option that I see is moving the array to the heap, as described earlier. Sorry.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Hmmm... seems like I have found a solution. The compiler gives more room for change in /Zm when I clean the temp files before rebuilding after changing the number. In other words, I changed the /Zm number to 900, and chose clean on the build menu before building. That worked, but gives me two questions I am curious about. Why do I need to clean first to get a effect? Why does the number need to be som much bigger on VStudio.net vs. VS 6.0?
Can you somehow answer this?
|
|
|
|
|
Have you tried to dynamically allocate the array on the heap using the new operator? It may be a better solution. You may even want to wrap it in a class to manage computing the offsets into a linear array from your x, y, z coordinates...
Just allocate the array as linear:
CString *m_pScores;
m_pScores = new CString(18*12*50);
then when accessing them, compute the offset
CString GetScore(int iX, int iY, int iZ)
{
return *(m_pScores[iX * iY * iZ]);
}
void SetScore(int iX, int iY, int iZ, CString cScore)
{
*(m_pScores[iX * iY * iZ]) = cScore;
}
onwards and upwards...
|
|
|
|
|
First off, maybe a dumb question: If you simply multiply x, y, and z coordinates, how can you be sure that you don't have multiple combinations which gives the same result. Won't this be a problem
Second, it's a reason for my setup. I have 18 written pages, with a table on each which I had to get into a computer. Done. The tables had 12 coloumns each, and each coloumn had 50 diffrent values. I pretty much need a solution that easy to insert those data. It might just be me, but 10800 * SetScore don't seem to me to be the best way to go...?
I was looking for a better way to create those tables, so I appreciate that, but I need to do it without creating source-code-hell
------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
|
|
|
|
|