danijar
danijar

Reputation: 34175

Why does Visual Studio generate these additional files?

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.

Upvotes: 9

Views: 7421

Answers (4)

George Robinson
George Robinson

Reputation: 2125

To disable the generation of the .EXP and .LIB files:
In VisualStudio GUI, go to: Project's Properties->Linker->Command Line
...and add: /NOEXP /NOIMPLIB

To disable the generation of the .PDB file:
In VisualStudio GUI, go to Project's Properties->Linker->Debugging->Generate Debug Info
...and select: No

Upvotes: 0

tzg
tzg

Reputation: 666

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

Upvotes: 3

Sergey Maruda
Sergey Maruda

Reputation: 203

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

Upvotes: 1

Jeff Paquette
Jeff Paquette

Reputation: 7127

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

Upvotes: 7

Related Questions