9

In the output directory where Visual Studio places the compiled executable, there are three additional files of the types *.exp, *.lib, .pdb. I do not need those files and I would like to prevent the compiler from creating them.

This is how my build output directory looks like. I only need the *.exe file.

output directory with unwanted additional files

What are these additional files for? How can I disable that they are generated? If they are needed for the build process, is there a way to automatically remove them after the executable is created?

I am using Visual Studio 2012. If you need additional details, please comment.

danijar
  • 32,406
  • 45
  • 166
  • 297
  • 1
    PDB file http://stackoverflow.com/questions/3899573/what-is-a-pdb-file – Jeff Paquette Apr 03 '13 at 20:19
  • `Application.pdb` contains debugging information to help the debugger correlate the code in `Application.exe` with your source code. You almost certainly want that - especially in debug builds. The other two files are often generated for targets that are exporting functions. The question is why do you not want those files *generated*? Do they bother you in some way? – Nik Bougalis Apr 03 '13 at 20:21
  • Thanks to @JeffPaquette I disabled generation of the `*.pdb` file. I only want the `*.exe` file and I don't understand *why* I also get a library file. And I never heard of `*.exp` before. By the way it's all about my release build configuration. – danijar Apr 03 '13 at 20:26
  • You can create a post-build event if it ***really*** bothers you. It's in the project properties Build Events / Post-Build Event. Bigger question indeed is **why**? – Erwin Alva Apr 03 '13 at 20:27

3 Answers3

7

EXP and LIB files But I don't want that .lib or .exp file for my COM library! . You could probably set the location of these files in the "Intermediate Output" setting and not have them in your release folder

Community
  • 1
  • 1
Jeff Paquette
  • 7,089
  • 2
  • 31
  • 40
3

I'm assuming you are looking to have only the dll and exe files in your final release directory and the *.exp, *.lib, .pdb files left in your intermediate directory as to not clutter the directory you are working in.

Visual Studio 2017

Open properties (Right click on the project in the solution explorer): change settings as shown:

Import Library will define where the .lib and .exp files are created. enter image description here

Generate Program Database File defines where the .pdb file is created. enter image description here

Debug information format -- None will prevent pdb file from being created. Select this option for Release builds. enter image description here

tzg
  • 616
  • 1
  • 8
  • 17
  • 1
    Updated answer. The .exp and .lib are generated in the location specified by Import Library option. under Linker->Advanced. – tzg May 06 '22 at 16:21
  • Thanks for the update - things are definitely clearer now! – AJM May 06 '22 at 16:30
1

There some functions inside declared with as __declspec(dllexport). It means that they are exported and linker thinks that there is a need to link with this dynamic library (no matter it is exe or dll - in general the structure is the same) and creates *.lib and *.exp file

Sergey Maruda
  • 193
  • 1
  • 6