Skip to content

Commit afd9c34

Browse files
author
Andrewyuan34
authored
Update build instructions for Visual Studio (#1980)
1 parent 299e592 commit afd9c34

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/platform_specific_build_instructions.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,26 @@ On QNX, the pthread library is part of libc and usually included automatically
1515
[`pthread_create()`](https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.lib_ref/topic/p/pthread_create.html)).
1616
There's no separate pthread library to link.
1717

18-
## Building with Visual Studio 2015 or 2017
18+
## Building with Visual Studio 2015, 2017 or 2022
1919

2020
The `shlwapi` library (`-lshlwapi`) is required to support a call to `CPUInfo` which reads the registry. Either add `shlwapi.lib` under `[ Configuration Properties > Linker > Input ]`, or use the following:
2121

2222
```
2323
// Alternatively, can add libraries using linker options.
24+
25+
// First, Add the path to the generated library files (directory containing the `benchmark.lib`) in `[Configuration Properties > Linker > General > Additional Library Directories]`. Then do the following:
2426
#ifdef _WIN32
2527
#pragma comment ( lib, "Shlwapi.lib" )
2628
#ifdef _DEBUG
27-
#pragma comment ( lib, "benchmarkd.lib" )
29+
#pragma comment ( lib, "benchmark.lib" )
2830
#else
2931
#pragma comment ( lib, "benchmark.lib" )
3032
#endif
3133
#endif
3234
```
3335

36+
When using the static library, make sure to add `BENCHMARK_STATIC_DEFINE` under `[Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions]`
37+
3438
Can also use the graphical version of CMake:
3539
* Open `CMake GUI`.
3640
* Under `Where to build the binaries`, same path as source plus `build`.

0 commit comments

Comments
 (0)