Skip to content

Commit b60a6f7

Browse files
committed
Build/Link: Visual Studio screenshots
1 parent e3d8e2f commit b60a6f7

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed

docs/guides/build-and-link/index.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,32 @@ You'll need to include `git2.h`, and link to the binaries you built previously.
6666

6767
## Visual Studio
6868

69-
If you built libgit2 as a DLL (the default), you can bundle the produced DLL with your project, and use the `git2.dll` import library to have the linker load the DLL for you.
70-
Or you can write your own calls to `LoadLibrary`.
69+
Your Visual Studio project will need to know where to find the libgit2 headers and link libraries.
70+
Open up the project settings by clicking on the project in the Solution Explorer, and selecting `Properties`.
7171

72-
***TODO: Screenshots (add include path, library path, .lib)***
72+
[![Visual Studio Screenshot](vs-0.png)](vs-0.png)
7373

74-
If libgit2 is built as a static library, just link in the `git2.lib` file.
74+
Make sure you're configuring the proper build configuration:
75+
76+
[![Visual Studio Screenshot](vs-1.png)](vs-1.png)
77+
78+
Add `C:\path\to\libgit2\include` to "Additional Include Directories" under "C/C++ > General".
79+
80+
[![Visual Studio Screenshot](vs-2.png)](vs-2.png)
81+
82+
The linker will need to know where to find the `git2.lib` file.
83+
Add `C:\path\to\libgit2\build\Debug` to "Linker > General > Additional Library Directories".
84+
You may want to configure this path differently for a Release build.
85+
86+
[![Visual Studio Screenshot](vs-3.png)](vs-3.png)
87+
88+
Finally, add `git2.lib` to the list of libraries to link in:
89+
90+
[![Visual Studio Screenshot](vs-4.png)](vs-4.png)
91+
92+
If you built libgit2 as a static library, you're done!
93+
If it's a DLL, you'll have to make sure that `git2.dll` gets into the same directory as your output EXE file.
94+
You can do this with a post-build script (check "Build Events"), or by including the `git2.vcxproj` file in your solution, and changing its output directory to match where the rest of your binaries go.
7595

7696
## XCode
7797

docs/guides/build-and-link/vs-0.png

66.7 KB
Loading

docs/guides/build-and-link/vs-1.png

12.6 KB
Loading

docs/guides/build-and-link/vs-2.png

69.7 KB
Loading

docs/guides/build-and-link/vs-3.png

74.2 KB
Loading

docs/guides/build-and-link/vs-4.png

66.4 KB
Loading

0 commit comments

Comments
 (0)