how to #include third party libraries

前端 未结 2 497
-上瘾入骨i
-上瘾入骨i 2021-02-03 12:42

I have built and installed a library called OhNet. After make install the corresponding header files of the framework have been installed under usr/local/incl

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 13:17

    1. Use the -I compiler option to point to the 3rd party libraries directory (-I/usr/local/include/ohNet)
    2. Use #include "[whatever you need from oHNet].h" in your header files and compilation units as needed (Note: you might need to put relative prefix pathes for subdirecories in the 3rd party include paths tree here!)
    3. Use the -L linker option to specify a path to the 3rd party libs you need (-L/usr/local/lib probably)
    4. Use the -l linker option to specify any concrete 3rd libs you need (-l[oHNet] probably)

    Look in the directories what actually was installed there to figure what to place for [whatever you need from oHNet].h and [oHNet], s.th. like liboHNet.a for the latter.

    You didn't tag [tag:Eclipse CDT] explicitly here, but go to the Project->Properties->C++ Builder->Settings Dialog and look for C/C++ Includes and Linker Options.

提交回复
热议问题