Netbeans 8.1 IDE compiles and builds C programs but does not show their output

柔情痞子 提交于 2019-12-25 09:59:54

问题


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.


回答1:


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)



来源:https://stackoverflow.com/questions/34230413/netbeans-8-1-ide-compiles-and-builds-c-programs-but-does-not-show-their-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!