You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/build-and-link/index.md
+24-4Lines changed: 24 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,12 +66,32 @@ You'll need to include `git2.h`, and link to the binaries you built previously.
66
66
67
67
## Visual Studio
68
68
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`.
71
71
72
-
***TODO: Screenshots (add include path, library path, .lib)***
72
+
[](vs-0.png)
73
73
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
+
[](vs-1.png)
77
+
78
+
Add `C:\path\to\libgit2\include` to "Additional Include Directories" under "C/C++ > General".
79
+
80
+
[](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
+
[](vs-3.png)
87
+
88
+
Finally, add `git2.lib` to the list of libraries to link in:
89
+
90
+
[](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.
0 commit comments