Where do I put third-party libraries to set up a C++ Linux development environment?

后端 未结 4 1902
不知归路
不知归路 2020-12-22 19:15

I\'m not new in C++ although I\'m new in Linux. I\'m using CMake to precompile a cross-platform game engine with some third-party components, but I have a lot of doubts abou

4条回答
  •  不知归路
    2020-12-22 19:51

    Okay, so this is one of the basic questions and while I myself might not come across very clear on this, here goes:

    1. While building a project, your compiler will need to find the header files of the libraries. The headers must be in the include path.
    2. after compilation is done, the linker will look for the library binaries (files.so or something like that). These must be in the Library path.

    That's the basics.

    If you have some specific libaries, you can add them to your own project-specific lib/ and include/ directories and add them to the include path and the library path respectively.

    Adding these dirs to these paths can be done in many ways, depending upon how you are building the project. I'm sure there is something called LD_PATH involved in all this... But I don't really know the specifics involved with CMake.

    A little googling can help you do the above with CMake.

    Hope that helps,
    jrh

提交回复
热议问题