C++: External library in eclipse CDT

前端 未结 3 1129
無奈伤痛
無奈伤痛 2020-12-09 21:42

Now I am using eclipse CDT for my C/C++ Application, but there is problem when I link my external library, it could not be loaded properly at run time, even through I put th

相关标签:
3条回答
  • 2020-12-09 21:49

    You should pay attention to what is in parentheses: Other options (-Xlinker [option]).

    The way to pass options is different. Instead of using:

    -Wl,-rpath,'${ProjDirPath}/../../system/lib'
    

    You must use:

    -rpath '${ProjDirPath}/../../system/lib'
    

    That is, remove the "-Wl," and replace the second "," by " " (space).

    enter image description here

    enter image description here

    0 讨论(0)
  • 2020-12-09 21:56

    I normally configure

    1. the library
    2. the library search path (Needed for compiliation)
    3. the runtime search path (-rpath Linker option)

    (see images below and exchange the path in the Linker flags to that one you used in the library search path)

    Library Search path Linker options for runtime search path

    0 讨论(0)
  • 2020-12-09 22:02

    you should use -Wl,-rpath=${workspace_loc}/Liball and not -Wl,-rpath,${workspace_loc}/Liball.

    Also under library -l option add library like eg. for libgcc.a add only gcc

    0 讨论(0)
提交回复
热议问题