|
When you declare a static data member (in *.h file), you should also implement it in the *.cpp file:
class MyClass
{
static int x;
};
int MyClass::x;
So you missed to allocate the space for your static variable. Just a declaration of static data members is not enough.
|
|
|
|
|
VuNic wrote: static int x;
Has x been initialized/defined (in the .cpp file)?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes, I declared it in the .h file, and initialzed in the constructor.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
Just because it has been declared does not mean it has been defined. Define x in the class' .cpp file. Static members are initialized outside of any class methods (e.g., file scope).
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
First off, Sorry!, Time is running out for me , so out of panic, I wasn't quite listening to you guys completely. I should have put the definition of the static member again in the .cpp. I did it wrong doing it inside the constructor or a function. Now I put it out side the constructor. It's fine now.
<br />
#include <class.h><br />
int class::x;
void class::class()<br />
{<br />
int class::x;
}<br />
void class::func()<br />
{<br />
<br />
}<br />
Thanks, CL, David, viorel, cederic.. and SORRY FOR THE LATE ACKNOWLEDGEMENT . Need to rush.. thanks a lot.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
Hello!,
I need to code a program that works in UNIX and dos there I can use text color, green, red and so on. How can I do that?
the text I need to put on the screen need to be in color.
|
|
|
|
|
Well, VT/XTerm color codes can be used to write in color to a (supported) Unix console. I would suggest using something like the curses library for that, but it has been quite some time since I did any console-coloring so some other libraries may be around.
If you only need to run the app on Unix but access it from DOS (do you mean a Win32 Console?) and Unix, so that there is only one platform to build for, use curses and connect to it using a terminal emulator that supports ANSI/XCode color codes.
If you need to build for Unix and Windows, I would suggest that you use the Console Functions in Win32 to do coloring in the Windows/Console build.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
hey that's a cool work to do.. settextcolor() If remember it correctly. I dont know about UNIX though. And I'm talking about Borland C++ complier.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
In VC :
SetConsoleTextAttribute ( m_hConsole,<br />
FOREGROUND_RED |<br />
FOREGROUND_GREEN |<br />
FOREGROUND_BLUE );
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
Hi All,
How to enter only Hexadecimal values in EditBox in Dialog?
Thanks in Advance.
|
|
|
|
|
Use a masked-edit control. There are several to choose from here at CP. If that is too elaborate for you, derive your own class from CEdit() , and override the OnChar() method. In that method, only allow 0-9 and A-F characters.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Handle the WM_CHAR and allow only 0-9 + A-F + 'x' .
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
|
|
|
|
|
no backspace allowed ?
he will be surprised
|
|
|
|
|
WOW! You live in history? just like Van Helsing? oh man this thread is too old!!
by the way I'm like Google, don't like "deleting" :->
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
VuNic wrote: You live in history?
nope, just browsing the forum, searching for a topic, instead than asking for a question that has been asked soooo many times already
|
|
|
|
|
One of the controls I created some time ago supports filtering of input. You can use its implementation as an example of one way to restrict input to a certain set of characters (in your example, "0-9 " and "a-f ", and optionally "x ").
http://www.codeproject.com/editctrl/enhfocusedit.asp[^]
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
cn u send me an example as i easily undestand
i hav three dialog boxes
third dialog box contain menu
i want that when i goto third dialog box from first dialog box then its menu are disabled but when i go from second dialog box third dialog box menues are not disabled.
plz send me code how to do it
note : specially for viorel
Please mail me
-- modified at 8:40 Thursday 15th June, 2006
|
|
|
|
|
put a flag in the dialog. u should check this flag in the InitDialog. if flag is set, disable the menu.
so before calling the domodal function from the first dialog set this flag.
and when u call DoModal from the second dialog reset the flag..
nave
|
|
|
|
|
CAN U SEND ME SOME EXAMPLE PLZ
Please mail me
|
|
|
|
|
Hi,
I have some problem with this fn.
IMultiMediastream::GetDuration(..);
but this fn. worked well
IMultiMediastream::SetState(STREAMSTATE_RUN);
how to solve this problem
-- modified at 8:08 Thursday 15th June, 2006
|
|
|
|
|
Hi,
Is there any tool that can effectively find out the occurances of memory leaks?
Thanks in advance
Taruni
|
|
|
|
|
|
|
|
try out :-Rational Purifier .
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|