Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#125 Compiling under MSVC 2010 against wxWidgets 2.9.4

v1.0_(example)
closed-fixed
nobody
None
5
2014-08-11
2013-10-04
Alexey Elizarov
No

I tried to compile wxFormBuilder under MSVC 2010 against wxWidgets 2.9.4 and encountered some problems. I needed to change 4 files, the patches for them are attached.

mainframe.cpp:
The "#include <wx wxScintilla="" wxscintilla.h="">" should not be used for wxWidgets 2.9.

wxfbadvprops.cpp:
Compiling wxCHECK_MSG macro with injected #if at line 858 produced an error with MSVC 2010 compiler, so I moved #if out of the wxCHECK_MSG scope;
the propgrid->Connect call in wxPGSliderEditor didn't compile with wxWidgets 2.9.4, the class wxPGSliderEditor is not used (commented out with todo) when building with wxWidgets 2.9, so I commented out the call to Connect().
(I'm not sure if it is needed at all with wxWidgets 2.9.4 and, moreover, it seems to be a mismatch in the handler's function pointer and object pointer.)

wxformbuilder.lua:
The "../../src/controls/include" include path should not be used for wxWidgets 2.9;
the "WinMain" flag should be added for MSVC 2010 to link the exe, though, I haven't tested it for other compilers.

wxwidgets.lua:
"gcc" should be changed to wxCompiler to enable use of MSVC 2010;
the order of include paths for wxWidgets should be changed to compile "wxFormBuilder.rc" properly (to find proper "rcdefs.h");
the "Dbghelp" library should be added to the system libraries list for "SymGetSymFromAddr" and other functions called from "stack.cpp".

I used:
MSVS 2010 Professional 10.0.30319.1 RTMRel (with Service Pack 1)
wxFormBuilder r2071
wxWidgets 2.9.4

4 Attachments

Discussion

  • The same is applicable to the wxFormBuilder r2083 too.
    Repository: "svn://svn.code.sf.net/p/wxformbuilder/code/3.x/trunk".

     
  • This also works with wxWidgets 2.9.5.

     
  • The PT_STRINGLIST property editor works wrong with wxWidgets 2.9. (For properties like wxComboBox::choices.) For wxWidgets version >= 2.9.2 you need to fix "objinspect.cpp" (the patch for r2083 is attached). For wxWidgets version < 2.9.5 you need also fix a bug in the wxWidgets file "%WXWIN%\src\propgrid\props.cpp". The patch for wxWidgets 2.9.4 is attached, in the wxWidgets 2.9.5 the bug is fixed.

     
  • objinspect.cpp:

     
    Attachments
  • Thanks for the patches; I applied them.

     
  • Thanks for corrections. Now the project can be compiled except of "wxfbadvprops.cpp". It still raises an error at the propgrid->Connect call:

    error C2440: 'type cast' : cannot convert from 'bool (__thiscall wxPGEditor::* )(wxPropertyGrid *,wxPGProperty *,wxWindow *,wxEvent &) const' to 'wxCommandEventFunction'

    file: src\rad\inspector\wxfbadvprops.cpp, line: 899

    (wxFormBuilder r2119)

    The wxPGSliderEditor class is not actually used with wxVERSION_NUMBER >= 2900. It can be excluded from compilation completely.

    And, I suspect, if the questionable assignment were compiled, the event handler call would result in runtime error. The OnEvent method of wxPGEditor class is bound to propgrid (the last parameter of the Connect() call) that is of wxPropertyGrid class, it has nothing to do with wxPGEditor.

     
  • I think this ticket can be closed. All errors have been fixed. The current trunk revision (2188) + current wxWidgets 3.0.1 compiles with no errors under MSVC 2010.

     
    • status: open --> closed-fixed