Do NOT put your header files in /usr/include; put them in /usr/local/include. That is why this directory exists.
As for your other question, your .cpp files should be bundled together into a library, which can either be a shared-object type and/or a static type. This should be placed in /usr/local/lib.
The most basic of commands to build a shared-object and a static library are:
Code:
# Form object files from source files
#
g++ -Wall -fPIC -c One.cpp
g++ -Wall -fPIC -c Two.cpp
g++ -Wall -fPIC -c Etc.cpp
# For shared-object library
#
g++ -shared -o libMyStuff.so One.o Two.o Etc.o
# For static library
#
ar -r libMyStuff.a One.o Two.o Etc.o
Use /usr/bin/install, as root (ie. sudo) to install your header file(s) to /usr/local/include:
Code:
sudo mkdir -p /usr/local/include/mystuff
sudo install -m 644 *.h /usr/local/include/mystuff
Similarly for the shared-object and static library files:
Code:
sudo install -m 644 libMyStuff.a /usr/local/lib
sudo install -m 755 libMyStuff.so /usr/local/lib
Bookmarks