Thread: Makefile

  1. #1
    eat my shorts!
    Join Date
    Apr 2002



    when i run the following makefile:

    CFLAGS =-O -Wall -Wextra -Wshadow -Wstrict-prototypes \
              -Wmissing-prototypes -Wmissing-declarations \
              -Wmissing-field-initializers -Wredundant-decls -Wunreachable-code
    all: server2.o
            gcc -o server server2.o
    server2.o: server2.c
            gcc $(CFLAGS) server2.c
            rm -f core *.o
    i am getting the following error:
    gcc: server2.o: No such file or directory
    gcc: no input files
    make: *** [all] Error 1
    could someone point where i am doing it wrong?

    Last edited by dayknight; 01-09-2007 at 09:44 AM.
    Games Reviews Previews Desktop Themes Downloads Paintball Forums Shareware Freeware and much more

    The best in Technology and Gaming News

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > gcc $(CFLAGS) server2.c
    This line also needs to include the -c option (compile only) to produce the .o from the .c
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Or you could remove the line entirely and rely on Make's pattern handling.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefile Problem: None rule to make target
    By chris24300 in forum Linux Programming
    Replies: 25
    Last Post: 06-17-2009, 09:45 AM
  2. Building a project using a Makefile
    By starcatcher in forum Windows Programming
    Replies: 2
    Last Post: 11-23-2008, 11:50 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. makefile blues....
    By WaterNut in forum C Programming
    Replies: 6
    Last Post: 05-30-2005, 08:22 PM
  5. Need help with Makefile
    By xshapirox in forum C++ Programming
    Replies: 14
    Last Post: 09-28-2004, 03:32 PM