Results 1 to 2 of 2

Thread: Creating makefiles

  1. #1

    Creating makefiles

    Hello. It's me again. I've been trying to make a make file to compile all my source files at once. Needless to say, it's not working. The problem is in getting the linker to include files I specify with #include. Here's what I have for a makefile so far:

    ]code]
    unidos: main.o cd.o convert.o exec.o prompt.o
    ld -o unidos main.o cd.o convert.o exec.o prompt.o

    main.o: main.c header.h
    gcc -M -c main.c

    cd.o: cd.c header.h extern.h
    gcc -M -c cd.c

    convert.o: convert.c header.h extern.h
    gcc -M -c convert.c

    exec.o: exec.c header.h extern.h
    gcc -M -c exec.c

    prompt.o: prompt.c header.h extern.h
    gcc -M -c prompt.c
    [/code]
    Now before I put that -M in there, it said it couldn't find a lot of functions, like printf and strcat during the linking stage. I read in the gcc man page that the -M is used for passing along this include information to make, but after I put that in there, it doesn't even make any object files. Now I thought that with just the -c option, it would include all the include files in the object file, but that's obviously not the case. So can anyone put this knowledge in my head for me? I'd be quite thankful.

    By the way, I know that I can combine all those gcc lines into one line, but right now I'm just worried about making this work.

  2. #2

    Re: Creating makefiles

    Nevermind. One of my friends on Jabber helped me solve this. I just used gcc to link the object files instead of ld. I guess that's simple enough.

Similar Threads

  1. no modem in Redhat Linux 8??
    By in forum Linux - General Topics
    Replies: 172
    Last Post: 09-14-2003, 04:20 PM
  2. Linux worm creating P2P attack network
    By cloverm in forum General Chat
    Replies: 1
    Last Post: 09-16-2002, 03:51 AM
  3. creating mount point for dos/windows directory on dual boot
    By rioguia in forum Linux - Hardware, Networking & Security
    Replies: 4
    Last Post: 07-03-2002, 02:34 PM
  4. creating my own scripts
    By flandercan in forum Programming
    Replies: 9
    Last Post: 05-22-2002, 02:26 AM
  5. Creating audio tracks for burncd
    By kenshi in forum BSD
    Replies: 2
    Last Post: 12-02-2001, 01:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •