0

Hello,

I have to submit a makefile along with my source code for a project in my data structures class. I have never done this before, so I had to do a lot of Googling. Needless to say, I have successfully created a makefile and ran it, but I have found something strange. I am running on a Windows 7 machine, and using a g++ compiler. I downloaded the necessary program so that MinGW will run makefiles. However, only one variation of the commands work. I go to the directory I want and type "mingw32-make", then an error pops up saying "mingw32-make: **** No targets specified and no makefile found. Stop. But if I type "mingw32-make -f <filename.extension>" and hit enter, it works. Even though I have it working, it kind of concerns me that only one of the commands work. My professor will be compiling this in a Linux environment, and I would not like it to not compile because my makefile is somehow messed up. Are there any ideas why it is doing this? And just a side note, my makefile is a txt file named Makefile if that helps. Any help would be greatly appreciated.

2
Contributors
10
Replies
24
Views
4 Years
Discussion Span
Last Post by rofln
Featured Replies
  • On a \*nix operating system, you just name the file `Makefile` and that's it. On windows, I understand if you save the file as `"Makefile"` (with the `"`s) it won't secretly name it `Makefile.txt` ALternatively, you can change your Windows Explorer settings to show you the filename extensions, and then … Read More

0

When you say it's a textfile named Makefile, do you mean it is named Makefile or Makefile.txt ?

Edited by Moschops

0

What happens if you rename it Makefile ? make looks for a file named Makefile but it does not look for one named Makefile.txt

Edited by Moschops

0

Windows has a nasty habit of not telling you the extension. The fact that it can tell you (on the right there) that one file is a cpp file and one a text file, when of course there is no difference between the file types of a cpp file and a plain text file, suggests that it is called Makefile.txt and windows is hiding that from you.

Edited by Moschops

0

Is there supposed to be a special extension for the makefile?

0

Then how exactly am I supposed to create a makefile? The coding in the text file is correct. I ran it using the command that has -f in it and it worked. Earlier I tried doing a make using notepad++ but that had a .make extension.

1

On a *nix operating system, you just name the file Makefile and that's it. On windows, I understand if you save the file as "Makefile" (with the "s) it won't secretly name it Makefile.txt

ALternatively, you can change your Windows Explorer settings to show you the filename extensions, and then rename it without the extension. This is a problem with how your operating system displays file names to the user, and how your chosen text editor saves them.

Edited by Moschops

0

The " marks worked! Thank you so much!

Edited by rofln

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.