Hello!

So here I am again asking for your knowledge and help.:$

I have this little project of embedding the g++ compiler in my software.

What I have done so far is place the compiler inside the bin of my project folder, inside the Debug folder. I managed to call the cmd shell but the problem is whenever I pass commands to that cmd shell, it doesn't work. What happens is it opens a cmd shell and when I pass commands on it, it opens many other shells.

This is the g++ compiler that I'm using.

G++ Compiler

And here is my code. The code for compiling is very straightforward but I can't seem to make it work. Please take a look at it.

'For locating the path of the source code to be compiled.

Private Sub SaveFileDialog_FileOk(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog.FileOk

        SourceCodeLocation = SaveFileDialog.FileName()

End Sub

'Whenever the user chooses to compile the code.

Private Sub btnCompile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompile.Click

        Shell("cmd.exe")

        SendKeys.Send("PATH C:\Users\pseudo11\Documents\Visual Studio 2010\Projects\Server\Server\bin\Debug\cygwin-b20\H-i586-cygwin32\bin")
        SendKeys.Send("{ENTER}")
        SendKeys.Send("g++ " & SourceCodeLocation)
        SendKeys.Send("{ENTER}")
        SendKeys.Send("a.exe")
        SendKeys.Send("{ENTER}")
        SendKeys.Send("exit")
        SendKeys.Send("{ENTER}")

    End Sub

Thanks in advance!

Update:

I decided to reconsider the idea of using g++ and shifted to mounting a portable dev c++ compiler on the software.

It works now so I'll mark this thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.