Skip to content

Commit

Permalink
docs: improve windows VS tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
Mishura4 committed Jan 3, 2024
1 parent 00febe4 commit f3c078b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"stringified",
"disdppgloss",
"awaiter",
"awaiters",
"resumer",
"checkered",
"ramen",
Expand Down Expand Up @@ -136,7 +137,8 @@
"NOMINMAX",
"sku",
"skus",
"Codecademy"
"Codecademy",
"tparam"
],
"flagWords": [
"hte"
Expand Down
5 changes: 4 additions & 1 deletion docpages/install/install-windows-vs-zip.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

To add D++ to a Visual Studio project, using **Visual Studio 2019** or **Visual Studio 2022**, follow the steps below. The steps below assume an empty project, if you are adding to an existing project simply skip steps 1 through 4, and step 13.

\note It is possible to skip this entire tutorial, and obtain a [pre-made Visual Studio template containing the latest D++ build (for 32 and 64 bit, release and debug profiles) by clicking here](https://github.com/brainboxdotcc/windows-bot-template/).
\note It is possible to skip this entire tutorial, and obtain a \ref build-a-discord-bot-windows-visual-studio "pre-made Visual Studio template containing the latest D++ build (for 32 and 64 bit, release and debug profiles) by clicking here".

1. Make sure you have Visual Studio 2019 or 2022. Community, Professional or Enterprise work fine. These instructions are not for Visual Studio Code. You can [download the correct version here](https://visualstudio.microsoft.com/downloads/). Note that older versions of Visual Studio will not work as they do not support enough of the C++17 standard.

Expand Down Expand Up @@ -50,8 +50,11 @@ To add D++ to a Visual Studio project, using **Visual Studio 2019** or **Visual

## Troubleshooting

\note A much easier way of getting a bot running is available \ref build-a-discord-bot-windows-visual-studio "here"! We recommend using that one if this process seems too complex or you run into too many issues.

- If you get an error that a DLL is missing (e.g. `dpp.dll` or `opus.dll`) when starting your bot, then simply copy all DLLs from the **bin** directory of where you extracted the D++ zip file to, into the same directory where your bot's executable is. You only need to do this once. There should be several of these DLL files: `dpp.dll`, `zlib.dll`, `openssl.dll` and `libcrypto.dll` (or similarly named SSL related files), `libsodium.dll` and `opus.dll`.
- Please note that if you change the architecture (step 13) you must reconfigure all of steps 7 through 12 again as these configurations are specific to each architecture. This is to allow for different sets of precompiled libs, e.g. for `x86`, `x64`, etc.
- If you get an error that says "Debug/Release mismatch", **you are using the wrong configuration of the D++ dll**. Your bot's executable and the dpp.dll file should both be built in either Release or Debug, you get this error if they are different. We recommend using \ref build-a-discord-bot-windows-visual-studio "the bot template", it has all those things already set up.
- You should run your bot from a command prompt. If you do not, and it exits, you will not be able to see any output as the window will immediately close.
- If you need to update the `opus.dll` or `zlib.dll` (or any other prebuilt dll) these can be obtained by requesting them to be installed via `vcpkg` then copying the dlls, libraries and headers from the vcpkg `install` folder.
- Stuck? You can find us on the [official discord server](https://discord.gg/dpp) - ask away! We don't bite!
Expand Down
7 changes: 6 additions & 1 deletion docpages/make_a_bot/windows_vs.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ If you prefer a video tutorial, you can watch the video below! Otherwise, scroll
\image html vsproj_2.png
5. Click "Local Windows debugger" to compile and run your bot!
\image html vsproj_3.png
6. Observe the build output. There may be warnings, but so long as the build output ends with "1 succeeded" then the process has worked. You may now run your bot!
6. Observe the build output, so long as the build output ends with "1 succeeded" then the process has worked. You may now run your bot!
\image html vsproj_14.png

## Troubleshooting

- If you get an error that a DLL is missing (e.g. `dpp.dll` or `opus.dll`) when starting your bot, then simply copy all DLLs from the **bin** directory of where you cloned the D++ repository to, into the same directory where your bot's executable is. You only need to do this once. There should be several of these DLL files: `dpp.dll`, `zlib.dll`, `openssl.dll` and `libcrypto.dll` (or similarly named SSL related files), `libsodium.dll` and `opus.dll`. Note the template project does this for you, so you should never encounter this issue.
- If you get an error that looks like this: \code{.unparsed} 1>MyBot.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class dpp::async<struct dpp::confirmation_callback_t> __cdecl dpp::interaction_create_t::co_reply(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (__imp_?co_reply@interaction_create_t@dpp@@QEBA?AV?$async@Uconfirmation_callback_t@dpp@@@2@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: class dpp::task<void> __cdecl `int __cdecl main(void)'::`2'::<lambda_2>$_ResumeCoro$1::operator()(struct dpp::slashcommand_t const &)const " (??R<lambda_2>$_ResumeCoro$1@?1??main@@YAHXZ@QEBA?AV?$task@X@dpp@@AEBUslashcommand_t@3@@Z)
1>...\windows-bot-template-main\x64\Debug\MyBot.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "MyBot.vcxproj" -- FAILED.
\endcode Make sure your don't have another version of the library installed through vcpkg. The template uses a slightly different version of D++ that has coroutines, while the vcpkg version does not, and the latter overwrites it! Uninstalling the library through vcpkg should fix this issue.
- If you get an error that says "Debug/Release mismatch", **you are using the wrong configuration of the D++ dll**. Your bot's executable and the dpp.dll file should both be built in either Release or Debug, you get this error if they are different. **This also means you altered the template in a significant way,** we recommend you undo your modifications or reinstall the template.
- Stuck? You can find us on the [official Discord server](https://discord.gg/dpp) - ask away! We don't bite!

0 comments on commit f3c078b

Please sign in to comment.