News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Fix compiler invalid bug, when the default compiler does not exist

Started by Loaden, April 08, 2010, 11:39:31 AM

Previous topic - Next topic

Loaden

Two-compiler, one is VC9, one is MinGW, and the MinGW is set as the default compiler.
If the default compiler paths are changed, such as from "C:\MinGW" into the "C:\Test".

Restart CB, created VC project, will find "compile current file" and "Run" function is invalid!
The reason is :
ProjectBuildTarget* target; // target == NULL

Index: src/plugins/compilergcc/compilergcc.cpp

===================================================================

--- src/plugins/compilergcc/compilergcc.cpp (revision 6202)

+++ src/plugins/compilergcc/compilergcc.cpp (working copy)

@@ -1727,6 +1727,10 @@

             return RunSingleFile(Manager::Get()->GetEditorManager()->GetActiveEditor()->GetFilename());
         return -1;
     }
+    else
+    {
+        target = m_Project->GetBuildTarget(m_Project->GetActiveBuildTarget());
+    }
     DoPrepareQueue();
     if (!CompilerValid(target))
         return -1;
@@ -2912,8 +2916,14 @@


int CompilerGCC::CompileFile(const wxString& file)
{
+    ProjectBuildTarget* target = NULL;
+    if (CheckProject())
+    {
+        target = m_Project->GetBuildTarget(m_Project->GetActiveBuildTarget());
+    }
+
     DoPrepareQueue();
-    if (!CompilerValid())
+    if (!CompilerValid(target))
         return -1;

     ProjectFile* pf = m_Project ? m_Project->GetFileByFilename(file, true, false) : 0;



[attachment deleted by admin]