Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
694 views
in Technique[技术] by (71.8m points)

linux - C++: External library in eclipse CDT

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 the library file near the source file, I gave the library path, and it's name correctly.

project directory:

  1. include(.h files)
  2. source(.cpp. files..)
  3. lib(libbozorth3.a,LSFMatcher.a)

I want link that static libraries with my application I follow this steps:

  1. project->properties->general->path and symbols->include directory path,and libraries(bozorth3.a,LSFMatcher.a),and add library path .
  2. and also i add the same library in linker section also

When I build the program it displays a error cannot find -lbozorth3.a cannot find -lLSFMatcher.a

So I need the correct steps to add the external library to c/c++ application.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...