Author Topic: -std=c++11 not working (CB12.11)  (Read 30520 times)

Offline osdt

  • Multiple posting newcomer
  • *
  • Posts: 63
Re: -std=c++11 not working (CB12.11)
« Reply #30 on: April 24, 2013, 04:27:38 am »
Free untested annoying dialog:
Compiler error:
Code
/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:
Code
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

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: -std=c++11 not working (CB12.11)
« Reply #31 on: May 02, 2013, 04:30:51 am »
If there are no complaints, I will commit this soon.

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.)