Thread: using MAKE with makefile to create executable file

  1. #1
    Registered User sballew's Avatar
    Join Date
    Sep 2001
    Posts
    157

    using MAKE with makefile to create executable file

    Hey guys. Been working on separating huge (relative term) file into smaller files with creation of own header files. We are to create a main source file, a source file of function routines, and then a header file (with function prototypes in it -- no global variables in this program but they would go here too)
    Then create a makefile that creates the object files and is used in compilation of executable file; but I am getting compilation errors when I use the command MAKE . Any idea?

    (note: our C compiler uses command gcc to compile, not cc as the book shows AND our instructor said something about the option -lm to link a math library--not sure what this is for)

    Here's what I have in my directory named QE
    Code:
    ./         QE.c       QEfns.c    QEmain.c   makefile
    ../        QE.h       QEfns.o    QEmain.o
    Here's what my makefile looks like
    Code:
         QUADR: QEmain.o QEfns.o
                 gcc -o -lm QUADR QEmain.o QEfns.o
         QEmain.o: QEmain.c QE.h
                 gcc -c QEmain.c
         QEfns.o: QEfns.c QE.h
                 gcc -c QEfns.c
    Here's the compilation errors I am getting
    Code:
    212 /accounts/student2/srbkpk/QE make
    gcc -o -lm QUADR QEmain.o QEfns.o
    gcc: QUADR: No such file or directory
    *** Error code 1
    make: Fatal error: Command failed for target `QUADR'
    Sue B.

    dazed and confused


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Watch those command line parameter orders
    > gcc -o -lm QUADR QEmain.o QEfns.o
    gcc -o QUADR QEmain.o QEfns.o -lm

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  5. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM