How to Integrate C++ compiler in Visual Studio 2008
<p>Can someone help me with this issue?</p>

<p>I currently working on my project for final year of my honors degree. And we are developing a application to evaluate programming assignments of student ( for 1st year student level)</p>

<p>I just want to know how to integrate C++ compiler using C# code to compile C++ code.</p>

<p>In our case we are loading a student C++ code into text area, then with a click on button we want to compile the code. And if there any compilation errors it will be displayed on text area nearby. (Interface is attached herewith.)</p>

<p>And finally it able to execute the code if there aren't any compilation errors. And results will be displayed in console.</p>

<p>We were able to do this with a C#(C# code will be loaded to text area intead of C++ code) code using inbuilt compiler. But still not able to do for C# code.</p>

<p>Can anyone suggest a method to do this? It is possible to integrate external compiler to VS C# code? If possible how to achieve it?</p>

<p>Very grateful if anyone will contributing to solve this matter?</p>

<p>This is code for Build button which we proceed with C# code compiling</p>

<p>CodeDomProvider codeProvider = CodeDomProvider.CreateProvider("csharp");
            string Output = "Out.exe";
            Button ButtonObject = (Button)sender;</p>

<pre><code>        rtbresult.Text = "";
        System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
        //Make sure we generate an EXE, not a DLL
        parameters.GenerateExecutable = true;
        parameters.OutputAssembly = Output;
        CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, rtbcode.Text);

        if (results.Errors.Count &gt; 0)
        {

            rtbresult.ForeColor = Color.Red;
            foreach (CompilerError CompErr in results.Errors)
            {
                rtbresult.Text = rtbresult.Text +
                            "Line number " + CompErr.Line +
                            ", Error Number: " + CompErr.ErrorNumber +
                            ", '" + CompErr.ErrorText + ";" +
                            Environment.NewLine + Environment.NewLine;
            }
        }
        else
        {
            //Successful Compile
            rtbresult.ForeColor = Color.Blue;
            rtbresult.Text = "Success!";
            //If we clicked run then launch our EXE
            if (ButtonObject.Text == "Run") Process.Start(Output); // Run button
        }
</code></pre>
