Take the 2-minute tour ×

I am having trouble with make. I installed all of the features that come with cygwin. When I type in make command it says:


This is really annoying as it's a very simple program. My make file (Makefile):

# This is a sample file.

all: lab1

lab1: lab1.o
 g++ -Wall lab1.o -o lab1

lab1.o: lab1.cpp
 g++ -Wall -c lab1.cpp -o lab1.o

my program (lab1.cpp):

// This is a sample file written.

#include <iostream>

using namespace std;

int main() {
  cout << "Welcome to CS-240!" << endl;
  return 0;
share|improve this question
Could you please reformat your code and Makefile to be more readable? Also, is your Makefile named exactly that? Are you in the directory where the Makefile is when you run make? –  Jeremiah Willcock Jan 28 '11 at 21:11
Looks like make is not able to find your Makefile. Check the directory you are running make at. –  Elalfer Jan 28 '11 at 21:12
Are the spaces before g++ in your Makefile actually tabs? There needs to be exactly one tab (not expanded into spaces) before each command. That isn't the error you're getting, though. What is the path to your Makefile? What does pwd print out (in Bash) when you try to run make? –  Jeremiah Willcock Jan 28 '11 at 21:13
The Makefile needs to be named "Makefile", not "Makefile.mak". Use mv to change its name to remove the extension. –  Jeremiah Willcock Jan 28 '11 at 21:17
Makefile.mak or Makefile? –  tibur Jan 28 '11 at 21:17
show 11 more comments

1 Answer

up vote 0 down vote accepted

The issue (fixed in the comments) was that there was a Makefile.mak in the directory but not an actual Makefile without an extension. Changing the name worked for the submitter.

share|improve this answer
add comment

Your Answer


