0

MinGW can't find my projects source file. i created a source file named "Check.c", since windows has a "txt" extension to txt files, it's ".c.txt"

I've also edited the "PATH" environment variable to MinGW\bin

gcc does indeed work, but it can't find my source file which is located in D:\

here are the errors:

C:\Users\Mike\gcc D:\Check.c -o final
gcc: error: D:\Check.c: No such file or diretory
gcc: fatal error: no input files

i even tried to add "txt" extension:

C:\Users\Mike\gcc D:\Check.c.txt -o final
D:\Check.c.txt: file not recognized:File format not recognized
collect2.exe error: ld returned 1 exit status

I tried to drag the src file to the cmd manually, still does the same error.

How do i fix this

Medals
  • 131
  • 1
  • 4

1 Answers1

1

You need to remove that ".txt" from the filename.For that go to the directory where you have saved your file and do the below if you are not able to see ".txt" in you filename:

In Manu Bar, choose Tools > Folder Options.

Click the View tab in the Folder Options dialog box.

Deselect Hide Extensions For Known File Types.

Click OK.

Now you should be able to see that ".txt" in the end. Now rename the file and remove that ".txt" from the file name.

Hope this helps.

mSatyam
  • 531
  • 7
  • 25
  • Already did. doesn't help. btw in Windows 7 you have to go to the control panel inroder to do it.. – Medals Jul 05 '14 at 14:15
  • try moving to the directory where you saved file and then compile by giving relative path...and what is the extension of the file now – mSatyam Jul 05 '14 at 14:18
  • @Medals It's possible that Notepad added something called a "Byte-Order Mark" to the file data. Using Notepad++ you can convert the encoding to "UTF-8 without BOM". It's somewhere in the menu. – Zacrath Jul 05 '14 at 14:24
  • I think @Zacrath is right, try notepad++. As this post also have similar issue:http://stackoverflow.com/questions/8432584/how-to-make-notepad-to-save-text-in-utf-8-without-bom – mSatyam Jul 05 '14 at 14:29