|
1) The following goes in your header file or if use to surround the prototypes if you place them in one of your 'C++' files:
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
2) Now just add the 'C' file to your work space the same way that you would add a 'C++' file. The compiler knows that is is a 'C' and will compile it as 'C'.
OOORRRR
3) You can just change the .c extension to .cpp and the file will be compiled ass 'C++' whith out having to modify any code at all.
Trust in the code Luke. Yea right!
|
|
|
|
|
hello
i have developed a application.when i build it in debug mode it works fine but when i build it in release mode it gets crashed. can anybody help me in this issue . what might be the problem
thanking you
chan
|
|
|
|
|
Check your memory handling / array bounds.
In VC the Debug build generates safety pads for mem allocations / access, The release mode doesn't.
Check MSDN for more information. A search for 'Debug Build' will give you quite a few useful hints.
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
thanx for ur answer.
is it necessary to ship application in release build? if i have small exe then why not to ship it in debug build as it generates safety pads for mem allocations / access?
thanking you
chan
|
|
|
|
|
Yes, you must ship the release-version. As far as I know it is
not allow to redistribute the debug-versions of the VC-DLLs.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
take a look at the following page .. maybe it will help.
http://www.geocities.com/firepower_50ae/CodeNote/WinAPIfaq.html#141
-Tareq
|
|
|
|
|
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.
|
|
|
|