C ++ class library reference eclipse

External library is called: HelloSDK

Header: hello.h

Source File: mainso.c

Library: libhello.a, libhello.so

First, the static library:

1. Select the right project properties, as designated header file directory;

 

 

2. Specify the library file name and library file directory;

 

3. Click OK to save, so you go see the position as shown in the following configuration has been good.

 


Second, the dynamic library

1. The header file contains is the same, not repeat them, mainly explained how to refer to the dynamic library;

2, reference name specified dynamic library location in the source file;





For statically linked libraries and dynamic link libraries, may all encounter the following error.
Static link library, put the proposal under the project directory;
and dynamic link library, so you can handle:

If the above configuration is correct, then the compiler will be passed. But if you try to run, you will find the following error:
error loading the while the Libraries Shared: libxxx.so: CAN not Open Shared Object File: No File or Directory SUCH

see below:

add an environment variable:
Name must be LD_LIBRARY_PATH, dynamic link library path is located.

When run, this can help eliminate errors

Published 343 original articles · won praise 57 · Views 200,000 +

Guess you like

Origin blog.csdn.net/jadeshu/article/details/103724624