Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

wxSmith Compiling error in Linux

(1/2) > >>

jhaluska:
I've tried the following:

./configure --with-contrib-plugins=wxsmith
make

And I get the following error while compiling:


--- Code: ---./wxscoder.cpp: In member function 'bool wxsCoder::ApplyChangesEditor(cbEditor*, const wxString&, const wxString&, wxString&, bool, bool, wxString&)':
./wxscoder.cpp:378: error: no matching function for call to 'wxsCoder::RebuildCode(wxString&, const wxChar*, int, wxString&)'
./wxscoder.h:151: note: candidates are: wxString wxsCoder::RebuildCode(wxString&, const wchar_t*, int, wxString&)
./wxscoder.cpp: In member function 'bool wxsCoder::ApplyChangesString(wxString&, const wxString&, const wxString&, wxString&, bool, bool, bool&, wxString&)':
./wxscoder.cpp:466: error: no matching function for call to 'wxsCoder::RebuildCode(wxString&, const wxChar*, size_t, wxString&)'
./wxscoder.h:151: note: candidates are: wxString wxsCoder::RebuildCode(wxString&, const wchar_t*, int, wxString&)

--- End code ---

Anybody encounter this before?

stahta01:

--- Quote from: jhaluska on November 06, 2008, 07:45:04 pm ---Anybody encounter this before?

--- End quote ---

No, not seen it when using 2.8 wxWidgets; what version of wxWidgets are you using?
2.8.???.???

Have seen similar problem when using 2.9/trunk wxWidgets; the type of patch I am using shown below.
I change .c_str() to .wx_str() but an wxWidgets expert said it is not a solid fix for all wxWidgets builds, works for me under Windows XP.

--- Code: ---Index: src/plugins/contrib/wxSmith/wxscoder.cpp
===================================================================
--- src/plugins/contrib/wxSmith/wxscoder.cpp (revision 5297)
+++ src/plugins/contrib/wxSmith/wxscoder.cpp (working copy)
@@ -383,7 +383,7 @@
             ( ch == _T('\t') ) ? _T('\t') : _T(' '));
     }
 
-    Code = RebuildCode(BaseIndentation,Code.c_str(),(int)Code.Length(),EOL);
+    Code = RebuildCode(BaseIndentation,Code.wx_str(),(int)Code.Length(),EOL);
 
     // Fixing up positions to contain or not header / ending sequence
     if ( !CodeHasHeader ) Position += Header.Length();
@@ -478,7 +478,7 @@
             ( ch == _T('\t') ) ? _T('\t') : _T(' '));
     }
 
-    Code = RebuildCode(BaseIndentation,Code.c_str(),Code.Length(),EOL);
+    Code = RebuildCode(BaseIndentation,Code.wx_str(),Code.Length(),EOL);
 
     // Checking if code has really changed
     if ( Content.Mid(0,EndPosition) == Code )

--- End code ---

gus38:
I have the same error (with wxwidget 2.8.9 on X64)

I've changed the lines :

--- Code: ---    Code = RebuildCode(BaseIndentation,Code.c_str(),(int)Code.Length(),EOL);
--- End code ---
by

--- Code: ---    Code = RebuildCode(BaseIndentation,(wchar_t*)Code.c_str(),(int)Code.Length(),EOL);
--- End code ---

and it works for me

byo:
I don't understand the problem since wxString::c_str produces  const wxChar* (http://docs.wxwidgets.org/stable/wx_wxstring.html#wxstringcstr) and the function RebuildCode takes const wxChar* as an argument.

It looks like wxWidgets switches between ANSI / UNICODE modes (????)

And neither the wxString::wx_str() nor the wchar_t* cast is good solution. The first one does not exist in wx 2.8 series, the second is a bad workaround and in worst cases may lead to erasing wxSmith-generated code.

BTW. I don't have any problems on Ubuntu x64, wx 2.8.8

stahta01:

--- Quote from: byo on December 06, 2008, 07:31:24 pm ---I don't understand the problem since wxString::c_str produces  const wxChar* (http://docs.wxwidgets.org/stable/wx_wxstring.html#wxstringcstr) and the function RebuildCode takes const wxChar* as an argument.

It looks like wxWidgets switches between ANSI / UNICODE modes (????)

And neither the wxString::wx_str() nor the wchar_t* cast is good solution. The first one does not exist in wx 2.8 series, the second is a bad workaround and in worst cases may lead to erasing wxSmith-generated code.

BTW. I don't have any problems on Ubuntu x64, wx 2.8.8

--- End quote ---

FYI: IIRC wxString::wx_str() existed in 2.6 wxWidgets, it just was not documented any where I could find.

From 2.6.4 string.h

--- Code: ---    // identical to c_str(), for wxWin 1.6x compatibility
    const wxChar* wx_str()  const { return c_str(); }

--- End code ---
Tim S

Navigation

[0] Message Index

[#] Next page

Go to full version