|
Damn... I did that, but now I get:
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
I put a test cout line before the very first line in main() , and I saw the output of that line after the error... What is it? Is it a problem with the SDL files? Do you know? Thanks!
[EDIT] Fixed! There was a piece of code causing a memory leak... Thanks! [/EDIT]
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
-- modified at 19:22 Saturday 18th March, 2006
|
|
|
|
|
Hi,
I have never tried to derive a class from one of my own classes until now, but there is a problem. I have a simple class called CInstrument defined in the Instrument.h file. Since I have many instruments I wanted to derive a class for each unique instrument. For an oscilloscope I defined a class COscilloscope : CInstrument in the Oscilloscope.h file that also #includes the Instrument.h file. There is a third class where I want to create an instance of the Oscilloscope object but if I #include Oscilloscope.h in the third class then I get a C2011 'class' type redefinition error. I can't find where any #include is including the definition twice. Is there something basic that I am not seeing? My stuff looks like the examples in the texts I have.
Thanks
Buck Brown
|
|
|
|
|
Do you have a #pragma once in your header file? Or at least an #ifdef wrapper around your class declaration?
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
1st put re-inclusion guards in you header files. e.g.
#ifndef __HEADER1_H__
#define __HEADER1_H__
#endif // !__HEADER1_H__
The preprocessor symbol __HEADER1_H__ is named after the file - The important thing is that it's unique.
As PJ Arends mentioned you can use #pragma once to achieve the same effect on compilers that support it.
Also when you derive it looked like this:
<code></code>class COscilloscope : CInstrument
You probably meant this:
<code></code>class COscilloscope : public CInstrument
What you had is the same as this:
<code></code>class COscilloscope : private CInstrument
Legal but probably not what you intended.
Steve
|
|
|
|
|
Thanks,
I love simple answers. Works great, lasts a long time.
Buck
|
|
|
|
|
Hello ,
I would be grateful if you could tell me exactly how to download
VC++ Express Edition 2005 on a CD rom.
This in order to setting it up on an other computer.
Can I have a key too?
Note that the other computer has no internet connection.
Also, where could I find tested samples for VC++ Express Edition 2005.
I Thank you!
Regards,
TPP
|
|
|
|
|
|
Thanks a lot,
But you get a regulat key? for the other computer ?
your link is exactly what I was looking for!
Thanks and Regards,
TPP
|
|
|
|
|
I have found a few examples of how to use the richedit control 4.1 within an MFC app, but does anybody know how I can implement its usage in a non-mfc app?
I have a dialog with a rich edit control which contains a table. currently I'm using version 3 of the control which shows the table, but when it comes to populating cells I'm having problems. Mainly that the control doesn't seem to implement much of the table formating commands. The table cells do not resize, /par is ignored /qc is ignored etc...
I doubt my code is to blame as I am simply loading a rtf file created with version 4.1 and displaying it within my own control.
|
|
|
|
|
Nevr mind, I fixed it. For anybody else who may be trying to do the same:
In WinMain:
InitCommonControlsEx()
LoadLibrary( "Msftedit.dll" ); // check the return value
When creating the window:
CreateWindowEx(0,"RICHEDIT50W","",WS_TABSTOP ....
If you created the control using the resource editor, you must open the .rc file with a text editor and change the class from "RICHEDIT" to "RICHEDIT50W".
Point to note, the Msftedit.dll is not distributable, and it will only work with Windows XP service pack 1 and above.
|
|
|
|
|
Hi everyone. anyone knows how to create a trackbar in visual c++ using Win32 API?? I dont know what header file to include. Thanks in advance.
AmanN
|
|
|
|
|
You need to include commctrl.h and link with comctl32.lib. You create a trackbar pretty much the same as any other control
InitCommonControls();
hwndTrack = CreateWindowEx(
0,
TRACKBAR_CLASS,
"Trackbar Control",
WS_CHILD | WS_VISIBLE |
TBS_AUTOTICKS | TBS_ENABLESELRANGE,
10, 10,
200, 30,
hwndDlg,
ID_TRACKBAR,
g_hinst,
NULL
);
You can find a wealt of information here[^] regarding track bars and how to use them.
|
|
|
|
|
|
If I am to add an IE favourite programmaticallly
- is there an IE API?
- where are the favourites stored in registry?
thanks!
|
|
|
|
|
|
I used MFC AppWizard->Selected Single Document Interface-> and all nexts then clicked ok at step six using Visual Studio 6.0.
I then put this following code in the OnDraw() function in FilenameView.cpp.
I didn't change any other codes than this.
void CWoosooView::OnDraw(CDC* pDC)
{
CWoosooDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
///////////////////////
// MY CODE STARTS HERE
///////////////////////
///////////////////////////////////////
// i tried to make a pointer and put in some numbers 0~255 to make a rectangle pyramid.
///////////////////////////////////////
int size;
unsigned char *p;
p = (unsigned char*)malloc(size*size);
for(int y = 0; y<size; y++)
{
="" for(int="" x="0;" x<size;x++)
{
="" if="" ((x="">=0 && x<(size/2))&&(y>=0 && y<(size/2)))
*(p+size*y+x) = (x+y);
else if ((x<size &&="" x="">=(size/2))&&(y>=0 && y<(size/2)))
*(p+size*y+x) = (size-x+y-1);
else if ((x>=0 && x<(size/2))&&(y<size &&="" y="">=(size/2)))
*(p+size*y+x) = (size+x-y-1);
else if ((x<size &&="" x="">=(size/2))&&(y<size &&="" y="">=(size/2)))
*(p+size*y+x) = (2*size-2-x-y);
}
}
////////////////////////////////////
CBitmap bitmap; // i made a bitmap
CDC memDC; // and a device context
memDC.CreateCompatibleDC(pDC);// then made it compatible
bitmap.CreateBitmap(size,size,1,8,p);//**************problem line
memDC.SelectObject(bitmap);// then let the device context select it.
pDC->StretchBlt(0,0,size,size,&memDC,0,0,size,size,SRCCOPY);// and displayed.
free(p);
}
///////////////////////
// MY CODE ENDS HERE
///////////////////////
}
***********problem line, which is ====> bitmap.CreateBitmap(size,size,1,8,p);
// here's the problem. when i change the 4th value 8 to 1, a monochrome pyramid appears when executed. but i'm trying to make the pyramid smoother just like the greyscale. so 8 should be left 8, i think....
Right now, nothing appears on screen.
someone plz helpme~~
woosoo
-- modified at 12:02 Friday 17th March, 2006
|
|
|
|
|
|
|
Is there a "trick" to get the next biggest power of two for a given value?
I wonder if there's something without a loop (or a binary search).
I know the N & (N-1) == 0 <==> N is a power of two trick, but that doesn't help me much finding something.
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
|
Wow!
thanks - I just had the entire dev team come to a screeching halt after asking the question...
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
peterchen wrote: I just had the entire dev team come to a screeching halt after asking the question...
So this question did cost your company several million dollars?!?
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
We ain't that big, and it was friday afternoon... (sorry, boss)
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
|
Another solution would be:
int iNextPower2 = 0;<br />
double x;
<br />
iNextPower2 = (int)((log10(x)/log10(2) + 0.5)
This works for raising any base to a power... number of significant digits for an octal number representation of a decimal number would be:
<br />
iPower = (int)((log10(decimalvalue)/log10(8) + 0.5)
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|