C ++ compiler dynamic link library

Simple records, afraid to forget.

g++ -L ./lib -o C_Sample C_Api_Sample.cpp -I ./include -lonnxruntime -std=c++14

please explain:

-L is behind with the library catalog (.so the end of the dynamic library file directory)

-I behind with the header file directory

-lxxx represented here are libxxx.so dynamic library link

-std = c ++ 14 using standard c ++ 14.

 

Previous use compiler directives generally g ++ a.cpp -oa is actually expanded on this basis.

Such as generating program called C_Sample, Application: ldd C_Sample check whether the address is a dynamic library link into it.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ 

This sentence can solve the problem of not found .so.

Guess you like

Origin www.cnblogs.com/caozy623/p/12432012.html