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.