3
votes

When I make an empty project in VS 2015 it automatically puts these libraries into "additional dependencies":

kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)

I have no idea what most of these are for, can they be safely removed?

2
"can they be safely removed?" Probably not. These are added for some reasons depending on the project type. - πάντα ῥεῖ
They are core libraries of the OS, removing ones like kernel32.lib will almost certainly result in a linker failure. In any case, any libraries which you do not require any functions from will simply not go into the import table of the resulting binary. - Olipro
uuid.lib is for GUID, which is used as a globally unique identifier for anything (COM objects in particular) that sits on computers. If you're not using COM objects or generating GUID to be used as something unique (like unique name for temporary files), then it's perfectly safe to remove. uuid.lib was not added by default until yr 2000, but when COM got so prevalent, VS team made it as part of default dependencies. - David Lee

2 Answers

12
votes

Many of them can be safely removed. Here's a quick rundown of what they are for:

  • kernel32 : Process and thread management, file and device I/O, memory allocation (keep this, the C and C++ runtime libraries and compiler-generated code uses it)
  • user32 : Window and menu management (keep this if using GUI, can remove for console apps) The base set of widgets (= predefined window classes, like buttons and checkboxes and scrollbars) are here.
  • gdi32 : Drawing (keep this if using custom rendered graphics, can remove if just using widgets)
  • comctl32 : Fancy new widgets, like trees, listviews, and progress bars
  • winspool : Advanced usage of printing beyond what GDI covers. I always remove it.
  • comdlg32 : Common dialogs, like Open and Save File Dialogs
  • advapi32 : Registry support, user account and access control, cryptography. I usually end up needing this one, your needs may differ.
  • shell32, shlwapi : Taskbar and notification tray UI and more helper functions, like predefined folders and path manipulation functions. Often useful, but many applications won't need it.
  • ole32, oleaut32 : OLE is the basis for ActiveX, DCOM, etc. Many of the newer OS APIs are COM objects, so you probably need to keep this.
  • uuid : Advanced OLE usage, probably not needed.
  • odbc32, odbccp32 : Database access using a very old and unfriendly API. I always remove these.

Italicized libraries are not in the default list, but more useful than half the ones that are.

1
votes

No, you can't remove them. These are the libraries that interface with Windows.

You do not need to worry about it. .lib are really small, and the .dlls they refer to are already present as part of your Windows installation.