简体   繁体   English

C++ 可执行文件包括 .obj、.lib 和 .dll 吗?

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

I have a C++ project that output a C++ .exe .我有一个输出 C++ .exe 的 C++ 项目。 The project is dependant of some .lib and .dll.该项目依赖于一些 .lib 和 .dll。 If I want to use the .exe on another server, can I just transfer the .exe withtout the .lib, .dll, and .obj?如果我想在另一台服务器上使用 .exe,我可以只传输 .exe 而没有 .lib、.dll 和 .obj 吗? Do the .exe was build so it 'includes' these files? .exe 是否已构建,因此它“包含”这些文件?

Thank you!谢谢!

The compile/link process in C++ is complex but generally follows this path. C++ 中的编译/链接过程很复杂,但通常遵循此路径。

cpp/hpp-> obj cpp/hpp-> obj

obj -> lib (.a) for a static library or obj -> dll (.so) for a dynamic library obj -> lib (.a) 用于静态库或 obj -> dll (.so) 用于动态库

obj, lib, dll -> exe obj、lib、dll -> exe

The link process will take obj and static libs and form a self contained exe.链接过程将采用 obj 和静态库并形成一个自包含的 exe。 The linker makes the exe depend on dlls but the exe will not contain the dynamic library.链接器使 exe 依赖于 dll,但 exe 将不包含动态库。

Answering your questions, the exe and dll(s) will be needed at runtime.回答您的问题,运行时需要 exe 和 dll。 The obj and static lib files will definitely not be needed at runtime. obj 和静态库文件在运行时肯定是不需要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM