I have TWO compilers for CB, the default compiler is MinGW(gcc), and another is MSVC.
Now, When I create new MSVC8 projects, and debug CB, when step to this code:
void NativeParser::AddCompilerDirs(cbProject* project)
In the project directory will create a project file, which reads:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
We can see this line:
<Option compiler="gcc" />It's must be msvc8, but NOT gcc!So, I make a patch to fix this BUG.
Like this:
CompileTargetBase* Wiz::RunProjectWizard(wxString* pFilename)
{
...
// now create the project
+ wxString defCompilerID = CompilerFactory::GetDefaultCompilerID();
+ CompilerFactory::SetDefaultCompiler(GetCompilerID());
theproject = Manager::Get()->GetProjectManager()->NewProject(prjname);
+ CompilerFactory::SetDefaultCompiler(defCompilerID);
if (!theproject)
{
cbMessageBox(_("Couldn't create the new project:\n") + prjdir, _("Error"), wxICON_ERROR);
Clear();
return 0;
}
This patch only add three statements.
Now, it's work well.
Patch in here:
Index: src/plugins/scriptedwizard/wiz.cpp
===================================================================
--- src/plugins/scriptedwizard/wiz.cpp (revision 6195)
+++ src/plugins/scriptedwizard/wiz.cpp (working copy)
@@ -346,7 +346,10 @@
}
// now create the project
+ wxString defCompilerID = CompilerFactory::GetDefaultCompilerID();
+ CompilerFactory::SetDefaultCompiler(GetCompilerID());
theproject = Manager::Get()->GetProjectManager()->NewProject(prjname);
+ CompilerFactory::SetDefaultCompiler(defCompilerID);
if (!theproject)
{
cbMessageBox(_("Couldn't create the new project:\n") + prjdir, _("Error"), wxICON_ERROR);
[attachment deleted by admin]