Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 964
Gabriel Beauchemin-Dauphinais Avatar asked Apr 08 '26 23:04

Gabriel Beauchemin-Dauphinais


1 Answers

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.

like image 99
Matthew Fisher Avatar answered Apr 11 '26 13:04

Matthew Fisher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!