i am not able to get output
Title
Question
i have used notepad++ to write the command when i try to run command in terminal using gcc talk.c -o myoutput it is showing this error gcc.exe: error: talk.c: No such file or directory
gcc.exe: error: myoutpout: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated. pls help me and explain it step by step
C-and-Cpp First-C-Program 05-06 min 40-50 sec
Answers:
If you had set the path in Environment Variables as explained in the pdf and doubled checked minGW is installed or not. One of the reason could be that you are not compiling talk.c from where you saved it. Lets say you saved talk.c in a folder named C Programs which is on the Desktop as it is in my case then after opening command prompt you have to reach the folder where it is saved. To run the talk.c program.I followed these steps:-
Step 1: Checked the path where talk.c is saved. In my case it is saved in this path: C:\Users\ASUS\Desktop\C Programs
Step 2: When I open my cmd it opened by default in this format: "C:\Users\ASUS>".
Step 3: I typed ''cd Desktop" to reach at Desktop. It will look like this: "C:\Users\ASUS>cd Desktop".
Step 4: It will look like this after pressing Enter: "C:\Users\ASUS\Desktop>".
Step 5: Next I typed "cd C Programs" and clicked Enter. Now, It look likes this: "C:\Users\ASUS\Desktop\C Programs>".
Step 6: Now, I followed the instructions as suggested in tutorial and typed "gcc talk.c -o myoutput" and pressed Enter.
Step 7: It was compiled although cmd didn't show anything except this "C:\Users\ASUS\Desktop\C Programs". It may show error in the case of any kind of error in program talk.c.
Step 8: Now lastly I typed "myoutput.exe" and pressed Enter. As it was instructed in the pdf for Windows user.
Step 9: It showed output and it was like this:
"C:\Users\ASUS\Desktop\C Programs> myoutput.exe
Talk To a Teacher.
C:\Users\ASUS\Desktop\C Programs>".
I hope this will solve your issue.
For compiling CPP program...
One should use ''g++'' instead ''gcc'' and for ".c" use ".cpp".
And to run CPP program one must only use program name and it will not work if one typed ".exe" after program name to run it.
Login to add comment