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. Creating a crontab .. this right?
    By pinehead in forum Linux - General Topics
    Replies: 1
    Last Post: 08-14-2004, 03:07 AM
  2. Creating tar.gz files.
    By shebang in forum Linux - General Topics
    Replies: 3
    Last Post: 02-22-2004, 08:20 PM
  3. Creating a website
    By mojo jojo in forum General Chat
    Replies: 1
    Last Post: 11-26-2003, 01:59 AM
  4. Creating a ISP
    By coltrane in forum Linux - General Topics
    Replies: 2
    Last Post: 01-22-2003, 05:46 PM
  5. Need help creating a domain name......
    By chadm1967 in forum General Chat
    Replies: 6
    Last Post: 12-21-2001, 03:28 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
  •