makefile

This is a discussion on makefile within the Linux Programming forums, part of the Platform Specific Boards category; I am running into some linking errors when I try to compile a C++ program using a Makefile. I have ...

  1. #1
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    107

    makefile

    I am running into some linking errors when I try to compile a C++ program using a Makefile. I have checked out the documentation but it seems I am missing something and maybe someone can easily spot it out.Here is the Makefile
    PHP Code:
    target main
    CPPFLAGS 
    += -Wall -Wextra -g
    linker
    =ld
    libs
    +=lsmfl-window -lsmfl-graphics
    LDFLAGS
    +=$(libs)
    $(
    target):main.o       
                
    $(CXX) $(LDGLAGS) $^ -$@ 
    main.omain.cc
               
    $(CXX) $(CPPFLAGS) $(CXXFLAGS) -$< -$@
    .
    PHONY:clean
               
    $(RM) -*.$(target
    Last edited by Aslaville; 07-30-2013 at 04:02 AM.
    In C++14 you just write "auto auto(auto auto) { auto; }".
    The compiler infers the rest from context.

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    Where are your CXX, CXXFLAGS and RM variables defined?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    107
    Quote Originally Posted by vart View Post
    Where are your CXX, CXXFLAGS and RM variables defined?
    Yes they are defined by default.
    This works :
    PHP Code:
    target main
    CPPFLAGS 
    += -Wall -Wextra -g
    libs
    =lsmfl-window -lsmfl-graphics 
    LDFLAGS
    +=$(libs)
    $(
    target):main   
             
    $(CXX) $(LDGLAGS) $^ -$@ 
    main.o  main.cc  
             
    $(CXX) $(CPPFLAGS) $(CXXFLAGS) -$< -$@    
    .
    PHONY:clean
    clean
    :
             $(
    RM) -*.$(target
    This doesn't :
    PHP Code:
    target main
    linker
    =ld
    CPPFLAGS 
    += -Wall -Wextra -g
    libs
    =lsmfl-window -lsmfl-graphics
     LDFLAGS
    +=$(libs)
    $(
    target):main.o
            
    $(linker) $(LDGLAGS) $^ -$@ 
    main.omain.cc
           
    $(CXX) $(CPPFLAGS) $(CXXFLAGS) -$< -$@
    .
    PHONY:clean
         clean
    :    $(RM) -*.$(target
    So I got with the first one.I guess ld doesn.t link to libC++ by default
    Last edited by Aslaville; 07-30-2013 at 04:14 AM.
    In C++14 you just write "auto auto(auto auto) { auto; }".
    The compiler infers the rest from context.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefile
    By vin_pll in forum C++ Programming
    Replies: 2
    Last Post: 01-11-2010, 11:14 PM
  2. Not sure how to put this into a Makefile
    By redruby147 in forum C Programming
    Replies: 4
    Last Post: 07-07-2009, 12:45 PM
  3. makefile
    By shuo in forum C++ Programming
    Replies: 1
    Last Post: 11-18-2007, 12:41 AM
  4. difference makefile makefile.am makefile.in
    By Bargi in forum Linux Programming
    Replies: 7
    Last Post: 10-28-2007, 02:08 PM
  5. makefile
    By natasha_adams in forum C Programming
    Replies: 1
    Last Post: 01-16-2006, 01:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21