title: make: *** No rule to make target `obj/main.o'. Stop
body: <p>I'm working on an SDL project for which I'm using a makefile to build it. I'm Doing this on windows with a MinGW w64 compiler and make.</p>
  <p>My project structure looks something like this</p>
  <pre><code>proj
  ------&gt;bin        #stores the executable
  ------&gt;include    #stroes the external library include files
  ------&gt;lib        #stores the lib files of the libraries
  ------&gt;obj        #stores the .o files
  ------&gt;src        #source files
  makefile
  
  </code></pre>
  <p>and my makefile looks something like this</p>
  <pre><code>CC = g++
  OUT = main
  ODIR = ./obj
  SDIR = ./src 
  OUTDIR = ./bin
  IDIR = ./include 
  LDIR = ./lib
  libs = -lmingw32 -lSDL2main -lSDL2
  OBJS = $(patsubst $(SDIR)/%.cpp,$(ODIR)/%.o,$(wildcard $(SDIR)/*.cpp))
  
  $(ODIR)/%.o : $(SDIR)/%.cpp
      $(CC) -c -I $(IDIR) -o $@ $^
  
  $(OUTDIR)/% : $(OBJS)
      $(CC) -L $(LDIR) -o $@ $^ $(libs)
  
  .PHONY : run
  
  run :
      $(OUTDIR)/$(OUT)
  
  </code></pre>
  <p>Initially, the makefile was working just fine, After I edited the makefile by editing the src variable and then un-did it the make files gives the error</p>
  <pre><code>make ./obj/main.o
  make: *** No rule to make target `obj/main.o'.  Stop.
  
  </code></pre>
  <p>I tried renaming the file to MakeFile or a.mk and tried to run it, but even that does not help.</p>
  <p>So what am I supposed to do to make it work?</p>