[CentOS, Eclipse] Load a library file in a C project
Thing you want to do
I want to add a C library to an Eclipse C project and use the API in the library
environment
- CentOS 7(1908)
- Eclipse eclipse-cpp-2019-09-R
manner
1. Copy the library file
- Create an "include" directory
- Store the inside of the directory containing the library (
.lib
) in the project directory.
(When you make
the shapefile
library, a directory called .lib
is created, and the library file is in it.)
- Copy the
shapefil.h
file and store it in the" include "directory created in your project
2. Library definition settings
- Right-click on the project "Properties"-> "C / C ++ Build"-> "Settings"-> "Tool Settings"

- Specify the folder that stores ".lib" in "G ++ Linker"-> "Library"-> "Library Path"
- Enter "shp" in "G ++ Linker"-> "Library"-> "Library" (specify "shp" instead of "libshp" in the file name)
- Note the following points when reading the library file
-Since
lib
attached to the file name is automatically assigned as a library prefix, it is necessary to call it with the name without lib
from the file name when reading.

Where I got stuck
- I don't know how to load the library in the first place
- Not only the path but also the library name is required to read the library file
URL that I used as a reference
How the C library works
eclipse settings