Thread: Help with Unix makefile

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    3

    Help with Unix makefile

    Below is my current makefile but it gives me the error
    'ake: Fatal error : Don't know how to make target 'MST.h
    Can anyone help me with this, all of the spaces are tabs I know.
    Each .cpp file includes each of the header files.
    Any help would be greatly appreciated.

    mst: Heap.o DisjointSet.o MST.o main.o
    g++ -o mst heap.o DisjointSet.o MST.o main.o
    Heap.o: Heap.cpp Heap.h DisjointSet.h MST.h
    g++ -c Heap.cpp
    DisjointSet.o: DisjointSet.cpp DisjointSet.h Heap.h MST.h
    g++ -c DisjointSet.cpp
    MST.o: MST.cpp MST.h DisjointSet.h Heap.h
    g++ -c MST.cpp
    main.cpp: MST.h Heap.h DisjointSet.h
    g++ -c main.cpp
    Last edited by feanor114; 04-28-2010 at 05:05 PM.

  2. #2
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    Fatal error : Don't know how to make target 'MST.h'
    That usually means it can't find the file - make sure it's in the working directory (or a standard 'include' directory)
    Consider this post signed

  3. #3
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Where's the command for making main.o?
    Quote Originally Posted by feanor114 View Post
    Code:
    main.cpp: MST.h Heap.h DisjointSet.h
              g++ -c main.cpp

  4. #4
    Registered User
    Join Date
    Apr 2010
    Posts
    3
    First I want to thank you for responding to my problem, I've fixed a few things but it still has the same error. The new file is posted, this time I remembered to capitalize Heap.o and I changed the
    main.cpp: to main.o:
    Does anyone have any other ideas it still tells me
    'ake: Fatal error: Don't know how to make target `MST.h

    run: Heap.o DisjointSet.o MST.o main.o
    g++ -o mst Heap.o DisjointSet.o MST.o main.o
    Heap.o: Heap.cpp Heap.h DisjointSet.h MST.h
    g++ -c Heap.cpp
    DisjointSet.o: DisjointSet.cpp DisjointSet.h Heap.h MST.h
    g++ -c DisjointSet.cpp
    MST.o: MST.cpp MST.h DisjointSet.h Heap.h
    g++ -c MST.cpp
    main.o: MST.h Heap.h DisjointSet.h
    g++ -c main.cpp

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    23
    That error means the file doesn't exist. Check that the file is in the same directory and actually named "MST.h". Also remember that it is case sensitive.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to program in unix
    By Cpro in forum Linux Programming
    Replies: 21
    Last Post: 02-12-2008, 10:54 AM
  2. Setting up a Unix box
    By @nthony in forum Tech Board
    Replies: 6
    Last Post: 07-22-2007, 10:22 PM
  3. unix makefile won't work but works in Dev C++
    By jk1998 in forum C++ Programming
    Replies: 1
    Last Post: 06-09-2007, 03:54 PM
  4. About Unix Programming - Making a career desision
    By null in forum C Programming
    Replies: 0
    Last Post: 10-14-2001, 07:37 AM
  5. Writing makefile in Unix
    By Mangesh in forum C Programming
    Replies: 2
    Last Post: 09-11-2001, 10:48 PM