C#高手来帮忙看下哪出错了

来源:百度知道 编辑:UC知道 时间:2024/07/06 18:48:26
这是一个配置编译器时的编译代码,可不管我怎么输入什么代码他总是提示编译出错。而且都是我在普通状态可以编译的代码。
高手帮忙看看哪出错了。也可以共同讨论讨论。
string _comPath = "D:\\study\\C#\\ACM\\conp\\";
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WorkingDirectory = _comPath;
startInfo.FileName = _comPath + "gcc.exe";
startInfo.Arguments = _comPath + "run.c -o run.exe";
Process p = new Process();
p.StartInfo = startInfo;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.UseShellExecute = false;
p.Start();
p.WaitForExit();
if (p.ExitCode != 0)
{
return false;
}
return true;
它可以运行,但永远返回FALSE,都不返回TRUE。。。。

如果有意讨论的可以发邮件:ygr556@163.com

什么错??

“在普通状态可以编译”----是什么样的普通状态?
在Windows上使用gcc编译器是可能会出一些问题的,也不一定是程序问题。

if (p.ExitCode != 0)
{
return false;
}
return true;

永远返回FALSE肯定是p.ExitCode的问题了,你debug下看看为什么p.ExitCode一直不是0
看看gcc.exe是不是有什么关于返回值的说明

new Process()
里面是什么?

不是太懂.帮不了你..只能学习

把报错写出来

加这个试试:
if(!page.ispostback)
{

}