Page 1 of 1
wxCrafter Stand-alone with MSVC 2010
Posted: Fri Dec 27, 2013 1:31 am
by coder99
Using wxCrafter 1.3 to generate a base frame for a project, then adding the code to a MSVC 2010 project, I end up with 3 unresolved external symbols, but cannot find where they are used or which library or compile option they might depend on.
Code: Select all
2>wxSkCrFrame.obj : error LNK2019: unresolved external symbol "public: void __thiscall wxControlContainerBase::SetCanFocus(bool)" (?SetCanFocus@wxControlContainerBase@@QAEX_N@Z) referenced in function "public: void __thiscall wxControlContainerBase::UpdateCanFocus(void)" (?UpdateCanFocus@wxControlContainerBase@@QAEXXZ)
2>wxSkCrBase.obj : error LNK2001: unresolved external symbol "public: void __thiscall wxControlContainerBase::SetCanFocus(bool)" (?SetCanFocus@wxControlContainerBase@@QAEX_N@Z)
2>wxSkCrFrame.obj : error LNK2001: unresolved external symbol "class wxEventTypeTag<class wxCommandEvent> const wxEVT_COMMAND_MENU_SELECTED" (?wxEVT_COMMAND_MENU_SELECTED@@3V?$wxEventTypeTag@VwxCommandEvent@@@@B)
2>wxSkCrBase.obj : error LNK2001: unresolved external symbol "class wxEventTypeTag<class wxCommandEvent> const wxEVT_COMMAND_MENU_SELECTED" (?wxEVT_COMMAND_MENU_SELECTED@@3V?$wxEventTypeTag@VwxCommandEvent@@@@B)
2>wxSkCrBase.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall wxSplitterWindow::SashHitTest(int,int,int)" (?SashHitTest@wxSplitterWindow@@UAE_NHHH@Z)
2>F:\pkg\wx\MSVCE2010\wxW-2.9.5\wxSkCr\DebUniStat\wxSkCr.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========
This has stopped me cold in trying to use wxCrafter in place of the old wxFB.
Running MSVC 2010 Express under Vista-64
Re: wxCrafter Stand-alone with MSVC 2010
Posted: Fri Dec 27, 2013 9:47 am
by eranif
All of the above errors are not code generated by wxCrafter - its wxWidgets
wxCrafter does not generate nor use any of the undefined symbols you are facing:
Code: Select all
wxControlContainerBase::SetCanFocus
wxSplitterWindow::SashHitTest
class wxEventTypeTag<class wxCommandEvent> const wxEVT_COMMAND_MENU_SELECTED
These are all wxwidgets internal symbols, make sure you have all the proper libraries in the linker options and you are linking against the proper libraries
Eran
Re: wxCrafter Stand-alone with MSVC 2010
Posted: Fri Dec 27, 2013 11:24 pm
by coder99
I understand your point, but ....
This problem shows up when I try to use the stand-alone wxCr to build the GUI for an existing app.
Previously the GUI was build using wxFB.
When I build the GUI in wxCr to look the same as the old GUI, generate the code and add the generated code to my existing project, replacing the code previously generated by wxFB,
then, when all is compiled, I get those linker errors.
Neither of the functions is used by my code.
Replacing my main app code with the main.cpp from the wxHello example and adjusting the class names to fit ends up giving exactly the same errors.
The one possibility could the differences in the libs & options compiled for and used by gcc - and assumed and expected by wxCr - compared to the ones used with MSVC.
In short, replacing the wxFB code with that from wxCr is _the_ difference ...
Re: wxCrafter Stand-alone with MSVC 2010
Posted: Fri Dec 27, 2013 11:40 pm
by eranif
coder99 wrote:The one possibility could the differences in the libs & options compiled for and used by gcc - and assumed and expected by wxCr - compared to the ones used with MSVC.
wxCrafter only generates code, it has no knowledge of the compiler being used and it definitely does not assume any flags will exists. Without some build information and seeing some code I am afraid I can't help you much.
Did you try a full rebuild? IIRC, wxFB does some hacks with wxSplitterWindow (something like creating a functions in the header files etc, make sure everything is replaced, and that you don't have any leftovers from wxFB code)
Eran
Re: wxCrafter Stand-alone with MSVC 2010
Posted: Tue Dec 31, 2013 7:10 am
by coder99
eranif wrote:wxCrafter only generates code, it has no knowledge of the compiler being used and it definitely does not assume any flags will exists. Without some build information and seeing some code I am afraid I can't help you much.
The project is intended to be built under MSVC 2010 Express - I can zip it all up and send you the project, though I'm not sure I want to 'publish' it in general
eranif wrote:
Did you try a full rebuild? IIRC, wxFB does some hacks with wxSplitterWindow (something like creating a functions in the header files etc, make sure everything is replaced, and that you don't have any leftovers from wxFB code)
Yes, I cleaned out the old wxFB code, renamed the wxCR base files, added them to the project and recompiled the whole project.
In the latest attempts at compile I get these errors which to me look to be directly from wxCrafter
Code: Select all
2>wxSkCrBaseFrame.obj : error LNK2001: unresolved external symbol "class wxEventTypeTag<class wxCommandEvent> const wxEVT_COMMAND_MENU_SELECTED" (?wxEVT_COMMAND_MENU_SELECTED@@3V?$wxEventTypeTag@VwxCommandEvent@@@@B)
2>wxSkCrBaseFrame.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall wxSplitterWindow::SashHitTest(int,int,int)" (?SashHitTest@wxSplitterWindow@@UAE_NHHH@Z)
2>wxSkCrBaseFrame.obj : error LNK2019: unresolved external symbol "public: void __thiscall wxControlContainerBase::SetCanFocus(bool)" (?SetCanFocus@wxControlContainerBase@@QAEX_N@Z) referenced in function "public: void __thiscall wxControlContainerBase::UpdateCanFocus(void)" (?UpdateCanFocus@wxControlContainerBase@@QAEXXZ)
2>wxSkCrFrame.obj : error LNK2001: unresolved external symbol "public: void __thiscall wxControlContainerBase::SetCanFocus(bool)" (?SetCanFocus@wxControlContainerBase@@QAEX_N@Z)
2>F:\pkg\wx\MSVCE2010\wxW-2.9.5\wxSkCr\DebUniStat\wxSkCr.exe : fatal error LNK1120: 3 unresolved externals
Re: wxCrafter Stand-alone with MSVC 2010
Posted: Tue Dec 31, 2013 10:41 am
by eranif
coder99 wrote:In the latest attempts at compile I get these errors which to me look to be directly from wxCrafter
It looks the same as the previous errors you got - so nothing changed here, right?
If the code compiles and its only problem with linking, then it _must_ be a problem with your wxWidgets build since wxCrafter can not affect the linking...
The functions wxControlContainerBase::SetCanFocus and wxSplitterWindow::SashHitTest are not generated by wxCrafter, so I don't see how it can be responsible for this linker errors...
How did you build your wxWidgets? also, which version of wxWidgets are you using?
coder99 wrote:The project is intended to be built under MSVC 2010 Express - I can zip it all up and send you the project, though I'm not sure I want to 'publish' it in general
I will only be able to test it under GCC and not VC. I don't have MSVC installed and I don't have wxWidgets built for MSVC (and I prefer not to install it)
Eran
Re: wxCrafter Stand-alone with MSVC 2010
Posted: Tue Dec 31, 2013 11:13 pm
by coder99
eranif wrote:
It looks the same as the previous errors you got - so nothing changed here, right?
Right, except that I am quite sure there is nothing left from wxFB
eranif wrote:
If the code compiles and its only problem with linking, then it _must_ be a problem with your wxWidgets build since wxCrafter can not affect the linking...
The functions wxControlContainerBase::SetCanFocus and wxSplitterWindow::SashHitTest are not generated by wxCrafter, so I don't see how it can be responsible for this linker errors...
Well, it could by using function calls in the generated code which are not resolved until linking time
eranif wrote:
How did you build your wxWidgets? also, which version of wxWidgets are you using?
I am using 2.9.5, using all static wxWidgets libs.
All my other apps have their GUIs build using wxFB and compile and work well enough.
By now, another app whose GUI was made using wxCrafter 1.4 compiles, links and runs without problems, so I will have to investigate where the problem lies at bit more with time.
Possibly 'upgrade' to wx3.0
eranif wrote:
I will only be able to test it under GCC and not VC. I don't have MSVC installed and I don't have wxWidgets built for MSVC (and I prefer not to install it)
I understand and in some ways don't blame you; the main reason I stuck with MSVC is because I was used to the IDE and debugger and some of the features, such a memory leak detection
Re: wxCrafter Stand-alone with MSVC 2010
Posted: Tue Dec 31, 2013 11:59 pm
by eranif
coder99 wrote:Well, it could by using function calls in the generated code which are not resolved until linking time
Do you actually use these functions ("SashHitTest" etc) in your code?
Cause I know that wxCrafter does not generate these functions nor uses them
Eran
Re: wxCrafter Stand-alone with MSVC 2010
Posted: Wed Jan 01, 2014 12:52 pm
by eranif
I am still waiting for the sources
Eran
Re: wxCrafter Stand-alone with MSVC 2010
Posted: Tue Jan 07, 2014 11:38 pm
by coder99
Hello Eran,
sorry for getting lost; had to recover from a hard drive problem.
It will take me a few more days to recover fully, but I would consider this thread/issue closed.
I no longer think it is is a problem with wxCrafter because I have been able to build a new GUI for another app just before my troubles started.
I'll try to mark this as resolved.
My suspicion currently is that it was a problem of my having too many versions of wxWidgets on my system and linking to the wrong one in relation to the headers.