Matthias Güntert
Matthias Güntert

Reputation: 4668

Where to "install" thirdparty libraries & header files to on Windows?

Where do you store your thirdparty libraries and header files to when developing C/C++ on Windows?

When developing on Linux the package managers usally installs thirdparty libraries to /usr/lib and /usr/include. So I know where to look for.

I am just starting to develop on Windows and made the mistake to install libraries to C:\Program Files which is a bad idea due to UAC and permission lookdown on Windows 10.

Is there some kind of best practice? Thanks in advance

Upvotes: 6

Views: 2463

Answers (1)

Dave S
Dave S

Reputation: 1502

Usually to one of these locations:

Commercial tools might have an installer and if so the location is indeed often Program Files [ (x86) ]

Libraries built from source (for example zlib for compression) go wherever you have your root folder for C++ projects. Using Visual Studio you might have a C: > VS17 folder with one sub-folder for each solution and each partner library. You then reference the H and LIB files using relative paths like ../../other-libraryname/include so that they will work if you move the VS17 library to a new drive or change its name.

In both cases, when building a setup package for deploying to another PC, you typically include only DLL files and code statically linked into your own EXE, you don't include H or LIB files. The default installation location for the setup will be Program Files, but if your third-party library includes COM objects they might recommend installing them to the Windows system32 folder.

Upvotes: 3

Related Questions