How to retrieve the errors of a C compiled code with GCC from a C# application -


I have a C # app which is one. Generates CPP file. I try to programmatically compile that file, such as using the GCC compiler:

  Private Zero Button 2_Click (Object Sender, EventErgus E) {Thread. Sleep (2000); Process process = process Start (@ "C: \ Program Files (x86) \ codeBlocks \ MinGW \ bin \ mingw32-gcc.exe", "-o one x.cpp"); Thread.Sleep (2000); }   

When I press 2 button, after 2 seconds, a console (GCC compiler) appears, but it disappears immediately so that I can not see its content .

I would like to see if the code contained in the x.cpp file has been successfully compiled, if there are errors generated by the GCC compiler.

Thank you very much.

If you need success / failure - check [exit code]) Generally, zero Success is, non-zero failure.

There is a general appouch for collecting output.

Perhaps for the debug / valid approach, the compiler will probably have to dump to log in to a file. Since the console you can create a CDM / BAT file so that the file can be redirected to the log and GCC

  ... gcc.exe% 1 1> 2 2>% 3   

and process it by . Call from Start . Note that you will need to handle the log file cleanly. On the other hand, you know what is in the log file and you do not have to worry if you have interpreted incorrectly in C #. Console output c #.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -