Thread: compiling using gprof

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    53
    Quote Originally Posted by CornedBee View Post
    I'm fairly sure, yes.

    There's other things wrong with the Makefile, too, such as passing the CPPFLAGS only to linking, but not to what you thought was compiling.

    You shouldn't even need the pattern rule. It's built in. Just set the CFLAGS correctly. Set LD to g++ to get C++ linking.
    I took the liberty of looking it up:

    Suffix Rules

    Also here:

    Managing Projects with GNU Make, Third Edition (look on page 24). The book does state: "Suffix rules were make’s original means for writing general rules. GNU make includes support for suffix rules, but they are considered obsolete having been replaced by pattern rules that are clearer and more general."

    I agree with your remarks on what's broken with the Makefile, though.

    --
    Computer Programming: An Introduction for the Scientifically Inclined

  2. #2
    Registered User
    Join Date
    Nov 2007
    Posts
    19
    don't you need a intruction

    Code:
     .SUFIXXES: .o .c
    to tell make to look out for .c and .o files ?

    as to
    Code:
     .c.o
    im 110% sure its a suffixe rule that "teachs" make how to create a .o file from a .c
    but you're instruction is not creating a .o file since i think you forgot the -c flag in

    Code:
    .c.o:
    	gcc  -Wall -pg $<
    should be

    Code:
    .c.o:
    	gcc  -Wall -c -pg $<
    Last edited by force of will; 05-27-2008 at 07:50 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can gprof go into each self-defined function?
    By lehe in forum C Programming
    Replies: 3
    Last Post: 03-26-2009, 10:30 PM
  2. Newbie Compiling Problem
    By Deronius in forum C++ Programming
    Replies: 3
    Last Post: 06-15-2008, 11:23 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Problem Compiling
    By Flakster in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 01:09 AM
  5. Compiling
    By Dae in forum C++ Programming
    Replies: 7
    Last Post: 06-15-2005, 01:08 AM