Assert Error: wxClassInfo:Register()

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.
preethis
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Dec 05, 2017 9:10 am

Assert Error: wxClassInfo:Register()

Postby preethis » Fri Apr 20, 2018 5:05 am

When i try to launch my application i am getting the below error:
" ..\..\src\common\object.cpp(251): assert "classInfo->Get(m_classname) == NULL " failed in wxClassInfo::Register(): Class "wxTreeListHeaderWindow2" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?
Do you want to stop the program?
You can choose cancel to suppress further warnings."


Am using wx3.0 in windows. My application is not using GUI.
Please help me resolving.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1756
Joined: Sun Jan 03, 2010 5:45 pm

Re: Assert Error: wxClassInfo:Register()

Postby PB » Fri Apr 20, 2018 6:48 am

This kind of error should show when linking to the same (dynamic) library more than once.

It is odd though, as you say you do not use GUI so you should not be linking against wxAdvanced anyway (unless you are using a monolithic DLL).

preethis
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Dec 05, 2017 9:10 am

Re: Assert Error: wxClassInfo:Register()

Postby preethis » Thu May 03, 2018 1:14 pm

Am just linking the below lib file. that too only once linked.
wxbase30u.lib

Preprocessor:
__WXMSW__
wxUSE_UNICODE=1
WXUSINGDLL
WXWIDGETSVERSION_2_5_OR_HIGHER

Please somebody help me to resolve this.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2787
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Assert Error: wxClassInfo:Register()

Postby ONEEYEMAN » Thu May 03, 2018 3:42 pm

Hi,
How did you build wxWidgets? I.e. did you use command line or IDE of some kind?
How do you build you software? Again with the command prompt or with IDE?

If you did use command prompt for any one of those above - please show the exact command used.
If not - do you have exactly the same options building you software as you used for building the wxWidgets?

Thank you.

preethis
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Dec 05, 2017 9:10 am

Re: Assert Error: wxClassInfo:Register()

Postby preethis » Sat May 05, 2018 3:42 am

we are using wx 3.0 that is pre-built and given by our client, Which is working fine.
When we try to integrate the same with our project will all the settings as in their project, it is throwing this warning.
Is there any way to hide this warning??

Thanks

preethis
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Dec 05, 2017 9:10 am

Re: Assert Error: wxClassInfo:Register()

Postby preethis » Sun May 06, 2018 6:10 am

We are not using command prompt to build. Using Visual Studio 2013 IDE.

Is there any way to hide this popup or to :roll: find which lib is linked more than once?
Please help me resolving this

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1756
Joined: Sun Jan 03, 2010 5:45 pm

Re: Assert Error: wxClassInfo:Register()

Postby PB » Sun May 06, 2018 8:12 am

Can you reproduce the issue with a new minimal project?

If you can, what happens when you replace your custom-built wxWidgets library with a regularly built wxWidgets library? Use debug version of the library and see from where (call stack) it gets triggered.

If you cannot, check the differences between the two projects.

BTW, you should not define wxUSE_UNICODE=1 in the project, that's for building the library. In the project you define either "UNICODE" or "_UNICODE"; actually these two are defined automatically by the IDE when the project has its character set set to "Use Unicode Character Set" in its General properties.

You say you link only one wxWidgets library wxbase30u.lib which AFAIK does not contain any GUI classes. Are you using wxWidgets GUI classes or not - wxBase is for command line stuff only? Even if you were linking against a single library built as monolithic, this library should be named wxmsw30u.lib, not wxbase30u.lib.

I do not even know where the class name comes from, TBH. Are you sure you are not linking against a library which itself links to wxWidgets?

preethis
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Dec 05, 2017 9:10 am

Re: Assert Error: wxClassInfo:Register()

Postby preethis » Wed Jun 13, 2018 4:27 am

I've a created a sample dll project with few functionalities[No dialog or message box NO GUI nothing].
Linker:
wxbase311u.lib
wxmsw311u_core.lib

Preprocessor:
WIN32;NDEBUG;_WINDOWS;_USRDLL;SAMPLE_EXPORTS;WXWIDGETSVERSION_2_5_OR_HIGHER;NOPCH;__WXMSW__;WXUSINGDLL;

Set as Unicode character Set and removed wxUSE_UNICODE=1

Created a sample exe application.
Linker:
wxbase311u.lib
wxmsw311u_core.lib
sample.lib

Preprocessor:
WIN32;NDEBUG;_WINDOWS;_USRDLL;WXWIDGETSVERSION_2_5_OR_HIGHER;NOPCH;__WXMSW__;WXUSINGDLL;

As attached with this, am getting warning pop-up.

We are using WX3.1 and it is pre-built and given by our client.
Please help me resolving this.
Attachments
wxerror_popup.png
wxerror_popup.png (14.15 KiB) Viewed 288 times

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1756
Joined: Sun Jan 03, 2010 5:45 pm

Re: Assert Error: wxClassInfo:Register()

Postby PB » Wed Jun 13, 2018 5:52 am

As I suggested before: Try doing the same with wxWidgets official build or the build of your own.

If this would work it is obvious that the issue is with the library provided by the client and you need to handle it with them.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2787
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Assert Error: wxClassInfo:Register()

Postby ONEEYEMAN » Mon Jun 18, 2018 5:34 pm

Hi,
Try to run the 'console' sample provided with the wxWidgets. If this run properly - check what settings are used in that project and try to reproduce it in you own.
Also - take a look at the dll sample that is available - maybe the settings there will give you some clue.

Thank you.


Return to “C++ Development”

Who is online

Users browsing this forum: No registered users and 19 guests