2 classes and wxDebug Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
asadilan
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Jul 27, 2010 10:42 pm

2 classes and wxDebug

Post by asadilan »

Hi all,

i have got 2 classes of the same name has the same GUI layout but uses different data.
these 2 classes are defined in 2 different project thus renaming one of them is something that id rather avoid at this time.
the 2 classes are meant for database connection setting (user name, password, server name and bla bla)

When i ran the project, the attached message pop up ( i am in debug) but not in release.
Is there a way i can switch e pop up message off?

Thank you
Attachments
debugalert.jpg
DerKleineNik
Knows some wx things
Knows some wx things
Posts: 29
Joined: Fri Sep 09, 2011 9:59 am

Re: 2 classes and wxDebug

Post by DerKleineNik »

Are these two classes with the same name in the same folder?
If yes the Compiler/Linker tries to compile/link them both and problems occur cause it doesn't "know" wich one is the right one.
As they have different data try to give them names corresponding to the data to specify them by giving not the same name twice.
asadilan
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Jul 27, 2010 10:42 pm

Re: 2 classes and wxDebug

Post by asadilan »

these are 2 classes with the same name in 2 different folder but used in 1 project.
i have separated them by adding namespace in the other class.
so in the header file i do
namespace X{
//class content
}

it works fine. just that the pop up message is annoying....
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: 2 classes and wxDebug

Post by Auria »

Do you use wxIMPLEMENT_DYNAMIC_CLASS ? If so I suggest you just don't use it, it probably won't help you in user code
"Keyboard not detected. Press F1 to continue"
-- Windows
asadilan
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Jul 27, 2010 10:42 pm

Re: 2 classes and wxDebug

Post by asadilan »

i guess you mean using wxIMPLEMENT_DYNAMIC_CLASS in one of the cpp file for the class.
I do use it.
if i dont use that then i will not be able to use that class by itself can i?
let me explain further. besides the usage of the 2 classes in 1 project, another project uses 1 class of the 2.
cSetting A and cSetting B. b is the one with namespace and a is the one without. Prj K uses both A and B, prj Z only use B. if i dont use implement_dynamic_class then prj Z wont compile, will it?
whats the implication of me using wxIMPLEMENT_DYNAMIC_CLASS?

Thanx
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: 2 classes and wxDebug

Post by Auria »

wxIMPLEMENT_DYNAMIC_CLASS is mostly internal to wxWidgets. Try to remove it (and the corresponding wxDECLARE_DYNAMIC_CLASS too), that won't prevent you from making a standard C++ use of the class
"Keyboard not detected. Press F1 to continue"
-- Windows
asadilan
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Jul 27, 2010 10:42 pm

Re: 2 classes and wxDebug

Post by asadilan »

Thanx Auria,

ill try that.
anywhere i can refer to if i am curious what it does?

THanx again.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: 2 classes and wxDebug

Post by Auria »

See http://docs.wxwidgets.org/stable/wx_rttimacros.html
wxWidgets uses its own RTTI ("run-time type identification") system which predates the current standard C++ RTTI and so is kept for backwards compatibility reasons but also because it allows some things which the standard RTTI doesn't directly support (such as creating a class from its name).

The standard C++ RTTI can be used in the user code without any problems and in general you shouldn't need to use the functions and the macros in this section unless you are thinking of modifying or adding any wxWidgets classes.
"Keyboard not detected. Press F1 to continue"
-- Windows
Post Reply