1

So I have run into an odd issue with makefiles using mingw's mingw32-make. I've scoured about and I'm clueless. It looks like this is a path issue where make is not looking into the correct folder, but I could be wrong..

I have configured it to run via nppexec so I am using this macro

mingw32-make.exe -f "$(CURRENT_DIRECTORY)\$(NAME_PART)$(EXT_PART)"

Which gives..

mingw32-make.exe: *** No rule to make target 'main.cpp', needed by 'main.o'.  Stop.

makefile.mak (I know it dosen't need an extension)

CPP = g++.exe 
CFLAGS = -g -Wall

all: sortA4

sortA4: main.o Sortings.o
$(CPP) $(CFLAGS) -o sortA4 main.o Sortings.o

main.o: main.cpp Sortings.h
$(CPP) $(CFLAGS) -c main.cpp

Sortings.o: Sortings.cpp Sortings.h
$(CPP) $(CFLAGS) -c Sortings.cpp

#clean: >>>temp removed for debugging
#   $(RM) count *.o *~
sashoalm
  • 75,001
  • 122
  • 434
  • 781
  • possible duplicate of [gcc makefile error: "No rule to make target ..."](http://stackoverflow.com/questions/834748/gcc-makefile-error-no-rule-to-make-target) – sashoalm Oct 08 '13 at 16:10
  • This may be a stupid question, but you are sure that there is a main.cpp in the directory of the Makefile? – nikolas Oct 08 '13 at 16:12
  • make looks for dependencies in the current directory. I don't know much about mingw, but I don't suppose it's much different. You probably need to be in the source directory for it to work. – rici Oct 08 '13 at 16:12
  • duplicate of http://stackoverflow.com/questions/834748/gcc-makefile-error-no-rule-to-make-target – kfsone Oct 08 '13 at 16:14
  • @kfsone,risi I checked that.. Put it under C and nothing – user2859337 Oct 08 '13 at 16:15
  • @njansen, it exists there but yep still that error – user2859337 Oct 08 '13 at 16:16
  • Everything is where it should be.. All under one folder etc etc. I just triple check I mean is there an extra switch for stating where it should look – user2859337 Oct 08 '13 at 16:19
  • @user2859337 Do you have a clear understand of what "current directory" means? Hint: it is not the directory where the exe is. – sashoalm Oct 08 '13 at 16:19
  • What is the value of "CURRENT_DIRECTORY"? Is it the same as the location of main.cpp? – kfsone Oct 08 '13 at 16:20
  • In this case cd is pointing to my files locations. Aka all the ones open, I am aware. – user2859337 Oct 08 '13 at 16:24

2 Answers2

1

Are you doing this from the command line or visual studio? Did you set the working directory for the command to be "$(CURRENT_DIRECTORY)"? If not, then it's trying to do this from the project/solution directory.

kfsone
  • 23,617
  • 2
  • 42
  • 74
0

All worked out.. I just forgot to change it because I set up the same thing on two computers and never updated where nppexec pointed. Stupid me for thinking it was fine..