Netbeans 8.1 IDE编译和构建C程序,但不显示其输出 [英] Netbeans 8.1 IDE compiles and builds C programs but does not show their output

查看:1346
本文介绍了Netbeans 8.1 IDE编译和构建C程序,但不显示其输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的笔记本电脑上安装了Java SE Development Kit 8u66和Netbeans IDE 8.1。
我目前正试图在IDE上练习C程序。但是,当我尝试运行任何C程序,我从来没有看到任何输出。
无论我尝试什么C程序,Netbeans IDE只编译和构建它。它从不显示任何输出,当我点击运行项目它保持程序运行,直到我关闭IDE。



我的问题是如何确保我得到一个输出没有失败每次我编译一个C程序成功?
[请注意,在我的笔记本电脑上安装了早期版本的Java SE Development Kit和Netbeans IDE 8.0.2时出现此问题]



尝试以下解决方案,但正如你从我的代码中可以看到的,它没有帮助:



请参见附带的错误图像



以下是代码:

  #include< stdio.h> 
#include< stdlib.h>
int main(void){
printf(Hello,world!);
fflush(stdout);
return(0);
}

我试图在Windows 8.1命令提示符下运行程序,到我的名为abc.exe的.exe文件。命令提示符从未显示任何输出[请注意,该程序在Netbeans IDE 8.1上执行]


c:\Users \ Vishu> cd c:\

c:> c:\Users\Vishu\Documents\NetBeansProjects\Practice\abc.exe
无输出,光标保持闪烁


我试过在Cygwin64 Terminal上运行程序,但是显示错误,而不是所需的输出。首先,我编译的源文件,名为main.c,进入.exe文件abc .exe,然后再编译成xyz.exe。我在两个.exe文件有错误。
请检查以下



对于abc.exe文件,我收到以下错误

  Vishu @ Sheshadri〜
$ cd C:/ Users / Vishu / Documents / NetBeansProjects / Practice

Vishu @ Sheshadri / cygdrive / c / Users / Vishu / Documents / NetBeansProjects / Practice
$ notepad main.c

Vishu @ Sheshadri / cygdrive / c / Users / Vishu / Documents / NetBeansProjects / Practice
$ gcc -o abc main .c

Vishu @ Sheshadri / cygdrive / c / Users / Vishu / Documents / NetBeansProjects / Practice
$ ./abc
1 [sig] -bash 4928 get_proc_lock: t获取sync_proc_subproc for(5,1),最后7,Win32错误0
537 [sig] -bash 4928 proc_subproc:无法获取proc锁。对于xyz.exe文件,我得到以下错误:



  Vishu @ Sheshadri〜
$ cd c:/ Users / Vishu / Documents / NetBeansProjects / Practice

Vishu @ Sheshadri / cygdrive / c / Users / Vishu / Documents / NetBeansProjects / Practice
$ gcc -o xyz main.c

Vishu @ Sheshadri / cygdrive / c / Users / Vishu / Documents / NetBeansProjects / Practice
$ ./xyz
2 [sig] -bash 3820 get_proc_lock:无法获取sync_proc_subproc(5,1),最后7个,Win32错误0
463 [sig ] -bash 3820 proc_subproc:无法获取proc锁。 what 5,val 1

附件中的图片显示了IDE日志中的错误/消息从IDE获取输出。
请参考附件Netbeans IDE 8.1记录错误。



解决方案

自从我第一次发布上述问题, IDE 8.1和安装的Eclipse IDE版本:Mars.1发行版(4.5.1)。但是,我也有类似的Eclipse IDE的问题。但是,直到我在我的笔记本电脑上禁用了一个活跃的免费防病毒软件。



当我的笔记本电脑上的免费防病毒软件被禁用,所有程序开始获得编译和构建成功。现在禁用了防病毒,我可以编译,构建和运行所有程序,并可以看到程序输出。



我禁用了我的反病毒检查以下链接:
所有Eclipse C ++程序无法运行,挂起启动代理



很可能,在使用Netbeans IDE时禁用防病毒可能会有帮助。但是,我卸载了IDE,我才能找出是否反病毒干扰它。但我认为它是安全的,假定它是真正的反病毒干扰Netbeans IDE,因为类似的问题与Eclipse IDE解决时,禁用反病毒软件。



感谢为解决上述问题作出贡献的所有人。



编辑 - 有关的错误是Avast Free Antivirus。
(程序版本:11.1.2245,病毒定义版本:160107-0,定义数:3,346,214)


I have Java SE Development Kit 8u66 and Netbeans IDE 8.1 installed on my laptop. I am currently trying to practise C programs on the IDE. However, when I try to run any C program, I never see any output. No matter what C program I try, the Netbeans IDE only compiles and builds it. It never shows any output and when I hit 'Run Project' it keeps the program running until I close the IDE.

My question is how do I ensure that I get an output without fail each time I compile a C program successfully? [Please note that this issue occurred while an earlier version of the Java SE Development Kit and Netbeans IDE 8.0.2 was installed on my laptop]

I also tried the following solution but as you can see from my code, it didn't help:

Please see the attached image of the error as well

The following is the code:

    #include <stdio.h>
    #include <stdlib.h>
       int main(void) {
       printf ("Hello, world!");
       fflush(stdout);
       return (0);
       }

I tried running the program on the windows 8.1 command prompt by entering the full path to my .exe file named abc.exe. The command prompt never showed any output [Please note that the program was complied on the Netbeans IDE 8.1]

c:\Users\Vishu>cd c:\
c:> c:\Users\Vishu\Documents\NetBeansProjects\Practice\abc.exe No output and the cursor kept blinking

I tried running the program on the Cygwin64 Terminal but I got errors displayed instead of the desired output. First, I compiled the source file, named main.c, into .exe files abc .exe and then later into xyz.exe. I got errors on both the .exe files. Please check the following

For the abc.exe file, I got the following error

Vishu@Sheshadri ~
$ cd C:/Users/Vishu/Documents/NetBeansProjects/Practice

Vishu@Sheshadri /cygdrive/c/Users/Vishu/Documents/NetBeansProjects/Practice
$ notepad main.c

Vishu@Sheshadri /cygdrive/c/Users/Vishu/Documents/NetBeansProjects/Practice
$ gcc -o abc main.c

Vishu@Sheshadri /cygdrive/c/Users/Vishu/Documents/NetBeansProjects/Practice
$ ./abc
  1 [sig] -bash 4928 get_proc_lock: Couldn't acquire sync_proc_subproc       for(5,1), last 7, Win32 error 0
  537 [sig] -bash 4928 proc_subproc: couldn't get proc lock. what 5, val 1

For the xyz.exe file, I got the following error

Vishu@Sheshadri ~
$ cd c:/Users/Vishu/Documents/NetBeansProjects/Practice

Vishu@Sheshadri /cygdrive/c/Users/Vishu/Documents/NetBeansProjects/Practice
$ gcc -o xyz main.c

Vishu@Sheshadri /cygdrive/c/Users/Vishu/Documents/NetBeansProjects/Practice
$ ./xyz
2 [sig] -bash 3820 get_proc_lock: Couldn't acquire sync_proc_subproc  for(5,1), last                                                                                                              7, Win32 error 0
463 [sig] -bash 3820 proc_subproc: couldn't get proc lock. what 5, val 1

The image attached here shows the errors/messages in the IDE log when trying to get an output from the IDE. Please refer the attached image Netbeans IDE 8.1 Log for the error.

解决方案

Since I first posted the above question, I have uninstalled the Netbeans IDE 8.1 and installed Eclipse IDE Version: Mars.1 Release (4.5.1). However, I had similar issues with the Eclipse IDE as well. But that was until I disabled an active free anti virus software on my laptop.

When the free anti virus software on my laptop was disabled, all programs started getting compiled and built successfully. With the anti virus now disabled, I am able to compile, build and run all programs and can see the program output as well.

I disabled my anti virus having checked the following link: All Eclipse C++ Programs Fail to Run, Hangs on "Launching Delegate"

In all likelihood, disabling the anti virus while using the Netbeans IDE would have helped. However, I uninstalled the IDE before I could find out if the anti virus was interfering with it in anyway. But I think it's safe to assume that it was indeed the anti virus interfering with the Netbeans IDE since similar issues with the Eclipse IDE got resolved when the anti virus software was disabled.

Thank you to everyone who contributed towards resolving the above mentioned issue.

Edit - The anti virus that caused the error in question is the Avast Free Antivirus. (Program Version: 11.1.2245, Virus Definitions version: 160107-0, Number of Defintions: 3,346,214)

这篇关于Netbeans 8.1 IDE编译和构建C程序,但不显示其输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆