Find the answer to your Linux question:
Results 1 to 2 of 2
Hi All, I have more than one libraries to link and generate an executable. But, whenever i try to link the library by g++ -L../../ main.cpp -lxp.a -lap.a ... I ...
  1. #1
    Just Joined!
    Join Date
    Jan 2008
    Posts
    9

    Order of Linking Libraries

    Hi All,

    I have more than one libraries to link and generate an executable.

    But, whenever i try to link the library by
    g++ -L../../ main.cpp -lxp.a -lap.a ...

    I get lot of undefined references to functions. All I want know is whether there is any order of linking so that we should maintain that order when linking libraries.

    Can any one please help me to resolve this problem

    Thanks & Regards
    Vikram

  2. #2
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    Should the code you are compiling (main.cpp) not go at the end of the command so that it can pick up the functions in the libraries?
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...