I'm working through a Makefile tutorial, and I hit a snag on the last example. I keep getting this error: 'make: *** No rule to make target 'obj/hellomake.o', needed by 'hellomake'. Stop.' I've checked the tutorial and my directory structure seems fine. Here's what it looks like:
- ./
- include/
- hellomake.h
- lib/
- Makefile
- src/
- hellofunc.c
- hellomake.c
- obj/
I'd love some advice on how to fix this. Thanks!
1 Answer
It sounds like there might be an issue in your Makefile or the way your files are organized. Can you share what your Makefile looks like? Also, just to double-check, when you ran the command, did you do it from the right directory?
You've mentioned that it compiles fine with other examples, but remember that the directory structure and filenames are crucial for this specific example. Ensure the paths in your Makefile are correctly set for those object files.
I just ran 'make' from the main project folder where the Makefile is located. My code follows the examples exactly, so I don’t think that should be the problem.