Link the .so file to the .cpp file using g ++ compilation.

I am trying to get a library to work in my C ++ project and there are no clear instructions on how to do this for people who are not used for C ++

The following link is the closest I came

it states the following

-L/path/to/my/library/folder -ldllname

also the following thread describes the following

gcc yourfile.cpp -lblah

Now from what I see, the -l+ command filename, for example, my file name directory/libtest.sowould be -ldirectory/libtest.so, that's right, can someone clarify

I am currently using the following command to compile my file maincpp.cpp, however I would like to include a .so file, called for example./directory/libtest.so

g++ -fPIC -o libgetmacip.so -shared -I $JAVA_HOME/include -I $JAVA_HOME/include/linux maincpp.cpp cpptoinclude.cpp
+4
1

, , -l + filename, , directory/libtest.so -ldirectory/libtest.so

, . -Ldirectory -ltest, .. -L , , , -L, libtest.so libtest.a -ltest lib .

, , -L -L, directory/libtest.so, , , , , , . ( ), .

+12

All Articles