Search code examples
c++dllexeexecutable

Do C++ executable includes .obj, .lib and .dll?


I have a C++ project that outputs a C++ .exe . The project is dependent on some .lib and .dll. If I want to use the .exe on another server, can I just transfer the .exe without the .lib, .dll, and .obj? Is the .exe built so it 'includes' these files?


Solution

  • The compile/link process in C++ is complex but generally follows this path.

    cpp/hpp-> obj

    obj -> lib (.a) for a static library or obj -> dll (.so) for a dynamic library

    obj, lib, dll -> exe

    The link process will take obj and static libs and form a self contained exe. The linker makes the exe depend on dlls but the exe will not contain the dynamic library.

    Answering your questions, the exe and dll(s) will be needed at runtime. The obj and static lib files will definitely not be needed at runtime.