Visual Studio: What exactly are lib files (used for)?

前端 未结 3 1023
谎友^
谎友^ 2021-01-13 09:43

I\'m learning C++ and came across those *.lib files that are obviously used by the linker. I had to set some additional dependencies for OpenGL.

  • What exactly a
3条回答
  •  一整个雨季
    2021-01-13 10:31

    What exactly are library files in this context used for?

    They are compiled and linked code just like your executable. They're called static libraries that other programs can link to at compile time. In the case of OpenGL, you link to their libraries to build an executable that can run OpenGL code. Dynamic libraries (DLLs) are another type of library that executables link against, except at runtime.

    What are their contents?

    Static libs contain linked object code just like an exe. The *.obj files are the object code that the compiler generates for the linker.

    How are they generated?

    When the compiler creates the object files, it passes the work to the linker. You can create them in your development environment, just like executables.

    Is there anything else worth knowing about them?

    Yeah, they're used everywhere, so it doesn't hurt to get used to them.

提交回复
热议问题