Author Topic: r13615 fails to compile with wxWidgets-3.3.0.0  (Read 1503 times)

Offline everSome

  • Multiple posting newcomer
  • *
  • Posts: 50
r13615 fails to compile with wxWidgets-3.3.0.0
« on: February 18, 2025, 05:42:12 am »
Seems wxWidgets-3.3.0.0 has gotten stricter in checking usage of macros such as _() and friends. In particular, sdk/pluginmanager.cpp line 764 doesn't work.:
static wxString RemoveCRAndTranslate(const wxString& value)
{
    wxString Result(value);
    Result.Replace("\r\n", "\n");
    return _(Result);
}


See
https://wxwidgets.org/help/msgid-literals/
for details.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6074
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: r13615 fails to compile with wxWidgets-3.3.0.0
« Reply #1 on: February 18, 2025, 06:13:37 am »
Thanks, so it looks like _() is not allowed by passing a wxString as argument.

How do we fix that issue in the function: RemoveCRAndTranslate()? Just remove the _() macro?

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline everSome

  • Multiple posting newcomer
  • *
  • Posts: 50
Re: r13615 fails to compile with wxWidgets-3.3.0.0
« Reply #2 on: February 18, 2025, 07:29:07 am »
Maybe use something like:
const wxString& wxGetTranslation    (    const wxString &     string,
      const wxString &     domain = wxEmptyString,
      const wxString &     context = wxEmptyString
   )    

as it takes a wxString as input.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1695
Re: r13615 fails to compile with wxWidgets-3.3.0.0
« Reply #3 on: February 18, 2025, 10:30:21 am »
Yes, wxGetTranslation() is the recommended method; see p.e this PR.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1695
Re: r13615 fails to compile with wxWidgets-3.3.0.0
« Reply #4 on: February 18, 2025, 01:54:41 pm »
I am fixing those issues, will commit in a while...

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1695
Re: r13615 fails to compile with wxWidgets-3.3.0.0
« Reply #5 on: February 18, 2025, 04:44:58 pm »
Fixed in r13616.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7730
    • My Best Post
Re: r13615 fails to compile with wxWidgets-3.3.0.0
« Reply #6 on: February 26, 2025, 05:43:15 pm »
Code
--- a/src/plugins/contrib/clangd_client/src/codecompletion/parser/parser.cpp
+++ b/src/plugins/contrib/clangd_client/src/codecompletion/parser/parser.cpp
@@ -1567,7 +1567,7 @@ void Parser::ShowGlobalChangeAnnoyingMsg()
                        "on the project title in the Workspace tree and selecting\n"
                        "'Reparse current project'.");
 
-        AnnoyingDialog dlg(_("Global settings warning"), _(warningMsg), wxART_WARNING,
+        AnnoyingDialog dlg(_("Global settings warning"), warningMsg, wxART_WARNING,
                            AnnoyingDialog::OK);
         dlg.ShowModal();
     }//endif size

I had to apply this patch to build master from https://github.com/arnholm/codeblocks_sfmirror.git   13621

Tim S.
« Last Edit: February 26, 2025, 05:49:59 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1695
Re: r13615 fails to compile with wxWidgets-3.3.0.0
« Reply #7 on: February 26, 2025, 05:55:37 pm »
This was fixed six hours ago by r13622.