System.DllNotFoundException
Problem
When attempting to run a SplashKit program, you may see an error message: System.DllNotFoundException unable to load DLL splashkit.dll
. This issue may stem from antivirus interference, path configuration, or project setup.
Solutions
Disable Antivirus Software Temporarily
Some antivirus programs may block splashkit.dll
. Temporarily disable your antivirus software and try running the program again.
Avoid Naming Conflicts
Ensure your project name is not “SplashKit,” as this can cause conflicts. Rename the project folder if necessary.
Use the Correct Terminal and Folder Setup
- Open the MINGW64 terminal, not the MSYS terminal, to create your project files.
- Ensure the project files are located in their own dedicated folder to avoid any path or configuration issues.
Manually Add splashkit.dll
to Your System PATH
To ensure Windows can locate splashkit.dll
, manually add its directory to your PATH environment variable:
- Follow steps 1–3 in the “Update your system PATH variable” section here.
- Return to this guide and continue with the instructions below.
Next Step
- In the “Edit environment variable” window, ensure the following paths are added to your PATH, similar to the example in the green box below:
- If any of the paths are missing, click New (red box) and add the missing path. Adjust it to match your own username.
- Once added, click OK in all windows, open a new MINGW64 terminal, and try running the program again.
Copy SplashKit Binaries to Your Build Output Folder (Last Resort)
If all else fails, try manually copying the SplashKit binaries to your project’s build output directory:
-
Navigate to the folder containing SplashKit binaries at
C:\msys64\home\(your username)\.splashkit\lib\win64
.Replace “(your username)” with your actual username (you can use the
whoami
command in the terminal to confirm your username).Your folder contents should look similar to this:
-
Copy all files from this folder into your project’s build output directory, which is typically located at:
<Project folder name>\bin\Debug\net7.0
For example, if your project folder is named “MyProject” and uses .NET 7.0, the path would be:
MyProject\bin\Debug\net7.0
Note: If you’re using a different .NET version, adjust the path accordingly.
Following these steps should help resolve the System.DllNotFoundException
error and allow your program to locate splashkit.dll
properly.