I am new to C++ programming and I am using Visual Studio 2019
I have a project that uses a dll xerces-c_2_1_0.dll.
This dll is in the same directory as the app .exe file is.
It runs fine on my PC.
When the app directory is copied to other PC's some work some generate an error:
"The program can't start because xerces-c_2_1_0.dll is missing from your computer. Try reinstalling the program to fix this problem"
One persons PC running Windows 7 the app runs fine
Another persons PC running Windows 7 the app generates this error.
the offending dll needs to be on their computer and in their computer's path OR in the same folder as the program. You need to provide this to the user or tell them to go get it.
it is clearly on YOUR computer, so you downloaded something and linked to something that uses it...
it sounds like you distributed the dll with the program, though? If that is the case, how is the user starting the program? You may still need to tie your folder into the path via the installer. If you are not using an installer, where you load the .dll, you can steal your path and cook up what is needed... get argv[0] which will have your program and its path, lift the path off it, then open the dll with a cooked up path... a bit clunky but not too difficult..
I did distribute the dll with the program exe. I looked in the directory on her PC and the dll and the app are both there.
She is trying to run it by double clicking the app exe file
Is there a directory on all PC's that will be in the users path that I could put the dll file in without causing other issue?
For example could I put the dll into the win32 directory or does it have to be registered?
yes, the windows folder is part of the path.
I use the system32 folder, when I do this, but be awere: this is a bit 'rude' and 'hackery' way to solve it. It works fine, but its not 'how it should be done'.
You don't have to register anything. The whole registration thing is half baked ... its not enforced and serves no purpose other than clutter.
I checked the spelling of the missing dll file and it is the same name as the one in the app folder
Now, here is what I did to fix the issue, but not sure why it failed to start with.
Originally I had copied the new app from a developers PC onto my employees PC then the missing dll error message displayed.
I copied the missing dll to the System32 folder and the error still happens.
So I went to my PC where the new app runs fine, I rebuilt the solution and copied the newly created app file to the employees PC and it works fine. Is it possible the app is pointing to a folder where the dll is? This is all I can think of that would cause the app from the developer to not find the dll and fail while the app I create finds the dll fine. The source is the same but the project may be defined different on my PC then it is on the developers PC.
I am new to Visual Studio, is there somewhere in the Project properties that defines where the dll is at and that is put into the app when it is built?
All I know is it is now working, but I would still like to know what happened for my knowledge.