Makefile gives make: *** No rule to make target using suffixs. Help please

This is a discussion on Makefile gives make: *** No rule to make target using suffixs. Help please within the C++ Programming forums, part of the General Programming Boards category; Hello! I'm trying to learn c++ from the ground up so I'm figuring out makefiles. I have Code: CPP = ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    101

    Question Makefile gives make: *** No rule to make target using suffixs. Help please

    Hello!

    I'm trying to learn c++ from the ground up so I'm figuring out makefiles.
    I have
    Code:
    CPP = g++
    OFLAG = -o
    .SUFFIXES : .o .cpp
    .cpp.o :
    	$(CPP) -c $<
    
    stw: main.o PieceClothing.o 
    	$(CPP) $(OFLAG) main main.o PieceClothing.o 
    	
    PieceClothing.o: PieceClothing.cpp PieceClothing.h 
    main.o: main.cpp PieceClothing.h
    And when I type make I get
    Code:
    make: *** No rule to make target `main.cpp', needed by `main.o'.  Stop.
    What am I doing wrong?
    Shouldn't the suffix rule take care of a target for main.cpp?

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    2,487
    The make command is saying it can not find the file "main.cpp" and does not know how to make it.

    Edit: Make normally only looks relative to single folder (normally current working directory) for files; I have no idea if this can be changed.

    Tim S.
    Last edited by stahta01; 04-27-2011 at 01:06 PM.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    101
    Thanks! That is correct, I though he didn't know what to do with main.cpp.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. make: Fatal error: Command failed for target `clean'
    By vaibhavs17 in forum C++ Programming
    Replies: 5
    Last Post: 02-02-2011, 03:37 AM
  2. Makefile Problem: None rule to make target
    By chris24300 in forum Linux Programming
    Replies: 25
    Last Post: 06-17-2009, 09:45 AM
  3. (Make) Controlling target prerequisites
    By Mario F. in forum Tech Board
    Replies: 5
    Last Post: 07-11-2007, 05:29 AM
  4. [Build Error] No rule to make target.......
    By Obbin in forum C Programming
    Replies: 4
    Last Post: 07-30-2006, 01:06 PM
  5. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21