6

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

Matthias Güntert
  • 4,013
  • 6
  • 41
  • 89
  • 2
    Amazingly I cannot find a treatment of this subject. I expected to see something from 2009 or 2011. Lots of MSYS and MinGW hits, but nothing purely Windows as a Windows developer would expect. Maybe my search-fu is really off today... – jww Feb 20 '18 at 21:38

1 Answers1

3

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.

Dave S
  • 1,427
  • 1
  • 16
  • 18