MegaGlest / megaglest-source

MegaGlest real-time strategy game engine (cross-platform, 3-d)
http://megaglest.org/
348 stars 89 forks source link

Fix build with wxWidgets 3 (wxString to std::string) #163

Closed susnux closed 6 years ago

susnux commented 7 years ago

When compiling with wxWidgets 3 the build fails, e.g. this error:

[  176s] /home/abuild/rpmbuild/BUILD/megaglest-3.13.0/source/glest_map_editor/main.cpp: In member function 'void MapEditor::MainWindow::onMenuFileLoad(wxCommandEvent&)':
[  176s] /home/abuild/rpmbuild/BUILD/megaglest-3.13.0/source/glest_map_editor/main.cpp:726:74: error: no matching function for call to 'wxMBConv::cWX2MB(wxString)'
[  176s]     const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
[  176s]                                                                           ^
[  176s] In file included from /usr/include/wx-3.0/wx/strvararg.h:20:0,
[  176s]                  from /usr/include/wx-3.0/wx/string.h:46,
[  176s]                  from /usr/include/wx-3.0/wx/memory.h:15,
[  176s]                  from /usr/include/wx-3.0/wx/object.h:19,
[  176s]                  from /usr/include/wx-3.0/wx/wx.h:15,
[  176s]                  from /home/abuild/rpmbuild/BUILD/megaglest-3.13.0/source/glest_map_editor/main.h:23,
[  176s]                  from /home/abuild/rpmbuild/BUILD/megaglest-3.13.0/source/glest_map_editor/main.cpp:12:
[  176s] /usr/include/wx-3.0/wx/strconv.h:117:24: note: candidate: const wxCharBuffer wxMBConv::cWX2MB(const wchar_t*) const
[  176s]      const wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); }
[  176s]                         ^~~~~~
[  176s] /usr/include/wx-3.0/wx/strconv.h:117:24: note:   no known conversion for argument 1 from 'wxString' to 'const wchar_t*'

This pullrequest will fix the issues with the xWC2MB functions. Tested with wxWidgets 3.0.2 and with 2.8.12 for compatibility testing.

andy5995 commented 7 years ago

I'm not one of the devs, but I have a couple comments about this:

The build doesn't fail on my system (Debian amd_64 stretch/testing)

Using wxWidgets version [3.0.2.0]

Though when running the g3dviewer from the installer, it fails, which @filux and @titiger are aware of.

On my system, MegaGlest 3.13.0 built 100%, and g3dviewer runs as expected.

susnux commented 7 years ago

@andy5995 Maybe some other configuration or different compiler? For better debug I attached the log file of the failed build: buildfailed.log.txt

andy5995 commented 7 years ago

@susnux I'm not too familiar with this area really. I saw @titiger discussed this PR a bit on IRC yesterday so he is aware of it.