makefile variable

Discussion in 'C++' started by juky ma, Dec 30, 2011.

  1. juky ma

    juky ma Guest

    all source code file are in the path(/opt/Hi3520_SDK_V1.0.5.0.c2/
    mpp_master/sample/hishow888/),a makefile also is here,all lib files
    are in the path(/opt/Hi3520_SDK_V1.0.5.0.c2/mpp_master/lib/),makefile
    looks like this
    MPP_PATH:=$(PWD)/../..
    LIB_PATH:=$(MPP_PATH)/lib
    LIBS := $(LIB_PATH)/libmpi.a
    $(warning test LIBS is $(LIBS ))
    $(CC) $(CFLAGS) -lpthread -lm -o $@ $^ $(LIBS)

    when making the makefile,a message(/opt/Hi3520_SDK_V1.0.5.0..c2/
    mpp_master/sample/hishow888/../../lib/libmpi.a) is prited .and the
    makefile runs ok.
    in the path(/opt/Hi3520_SDK_V1.0.5.0.c2/mpp_master/sample/
    hishow888/../../lib/),nothing is here,but the makefile runs ok.
    I want to know what happened.please
     
    juky ma, Dec 30, 2011
    #1
    1. Advertising

  2. juky ma

    Jorgen Grahn Guest

    On Fri, 2011-12-30, juky ma wrote:
    > all source code file are in the path(/opt/Hi3520_SDK_V1.0.5.0.c2/
    > mpp_master/sample/hishow888/),a makefile also is here,all lib files
    > are in the path(/opt/Hi3520_SDK_V1.0.5.0.c2/mpp_master/lib/),makefile
    > looks like this
    > MPP_PATH:=$(PWD)/../..
    > LIB_PATH:=$(MPP_PATH)/lib
    > LIBS := $(LIB_PATH)/libmpi.a
    > $(warning test LIBS is $(LIBS ))
    > $(CC) $(CFLAGS) -lpthread -lm -o $@ $^ $(LIBS)


    This is a bit off-topic here, but anyway:

    That's not the right way to link C++ code against a static library.
    Try

    $(CXX) $(CXXFLAGS) -o $@ $^ -L../../lib -lpthread -lm -lmpi

    I assumed you use GNU make and g++. Note that with gcc, you must use
    the g++ command (CXX, make calls it) to link, not the gcc command
    (CC).

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, Dec 30, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MACEI'S
    Replies:
    0
    Views:
    1,348
    MACEI'S
    Jul 10, 2003
  2. Karthik
    Replies:
    0
    Views:
    398
    Karthik
    Apr 29, 2004
  3. mfglinux
    Replies:
    11
    Views:
    707
    Roberto Bonvallet
    Sep 12, 2007
  4. juky ma

    makefile variable

    juky ma, Dec 30, 2011, in forum: C++
    Replies:
    1
    Views:
    217
    Victor Bazarov
    Dec 30, 2011
  5. David Filmer
    Replies:
    19
    Views:
    248
    Kevin Collins
    May 21, 2004
Loading...

Share This Page