News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

-std=c++11 not working (CB12.11)

Started by taimou, March 22, 2013, 06:40:34 AM

Previous topic - Next topic

osdt

Quote from: Alpha on April 24, 2013, 03:45:48 AM
Free untested annoying dialog:
Compiler error:

/share/source/c/osdt/codeblocks/master/src/plugins/compilergcc/compileroptionsdlg.cpp|937|error: no matching function for call to 'AnnoyingDialog::AnnoyingDialog(const wxChar*, wxString&, AnnoyingDialog::dStyle, <anonymous enum>)'


wxART_INFORMATION (default param) added:

Index: src/plugins/compilergcc/compileroptionsdlg.cpp
===================================================================
--- src/plugins/compilergcc/compileroptionsdlg.cpp (revision 9000)
+++ src/plugins/compilergcc/compileroptionsdlg.cpp (working copy)
@@ -900,6 +900,8 @@
         }
     }

+    wxArrayString compilerOpConflicts;
+    wxArrayString linkerOpConflicts;
     for (unsigned int i = 0; i < m_Options.GetCount(); ++i)
     {
         CompOption* copt = m_Options.GetOption(i);
@@ -916,15 +918,32 @@
         {
             // for disabled options, remove relative text option *and*
             // relative linker option
-            int idx = m_CompilerOptions.Index(copt->option);
-            if (idx != wxNOT_FOUND)
-                m_CompilerOptions.RemoveAt(idx, 1);
-            idx = m_LinkerOptions.Index(copt->additionalLibs);
-            if (idx != wxNOT_FOUND)
-                m_LinkerOptions.RemoveAt(idx, 1);
+            if (m_CompilerOptions.Index(copt->option) != wxNOT_FOUND)
+                compilerOpConflicts.Add(copt->option);
+            if (m_LinkerOptions.Index(copt->additionalLibs) != wxNOT_FOUND)
+                linkerOpConflicts.Add(copt->additionalLibs);
         }
     }

+    if (!compilerOpConflicts.IsEmpty() || !linkerOpConflicts.IsEmpty())
+    {
+        wxString msg =   _("The compiler flags\n  ")
+                       + GetStringFromArray(compilerOpConflicts, wxT("\n  "))
+                       + GetStringFromArray(linkerOpConflicts, wxT("\n  "));
+        msg.RemoveLast(2); // remove two trailing spaces
+        msg += _("were stated in 'Other Options' but unchecked in 'Compiler Flags'.\n"
+                 "Do you want to enable these flags?");
+        AnnoyingDialog dlg(_("Enable compiler flags?"), msg, wxART_INFORMATION,
+                           AnnoyingDialog::YES_NO, wxID_NO);
+        if (dlg.ShowModal() == wxID_NO)
+        {
+            for (size_t i = 0; i < compilerOpConflicts.GetCount(); ++i)
+                m_CompilerOptions.Remove(compilerOpConflicts[i]);
+            for (size_t i = 0; i < linkerOpConflicts.GetCount(); ++i)
+                m_LinkerOptions.Remove(linkerOpConflicts[i]);
+        }
+    }
+
     // linker options and libs
     wxListBox* lstLibs = XRCCTRL(*this, "lstLibs", wxListBox);
     for (int i = 0; i < (int)lstLibs->GetCount(); ++i)


Works as expected :)
I'll vote for wxID_YES instead of wxID_NO ;)

- osdt

Alpha

If there are no complaints, I will commit this soon.

Quote from: osdt on April 24, 2013, 04:27:38 AM
I'll vote for wxID_YES instead of wxID_NO ;)
It will be wxID_NO for the time being so that previous default behaviour remains consistent.  (However, this could change soon.)