Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem with MSVCP140d.dll  (Read 3585 times)

0 Members and 1 Guest are viewing this topic.

Ezert

  • Newbie
  • *
  • Posts: 12
    • View Profile
Problem with MSVCP140d.dll
« on: June 02, 2019, 06:53:32 pm »
Hello everybody.

Well. I installed SFML in Visual Studio with Static Link.
When I compile and run SFML programs on my computer, everything works.
The problem happens when I send my program to other computers and try to execute it: a missing "MSVCP140D.dll" warning appears...

Someone could help me?

I use Visual Studio 2017 and SFML 2.5.1

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problem with MSVCP140d.dll
« Reply #1 on: June 02, 2019, 07:52:04 pm »
I believe that to be the Visual Studio C++ runtime. It's the core C++ code and is needed to run any Visual Studio program.
To be clear, I presume you are statically linking SFML. You can, also, however, statically link the C++ core runtime. This is separate from statically linking SFML although you should also build SFML with the correct flag for doing so.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

fallahn

  • Hero Member
  • *****
  • Posts: 505
  • Buns.
    • View Profile
    • Trederia
Re: Problem with MSVCP140d.dll
« Reply #2 on: June 03, 2019, 08:46:21 am »
I'll also note that msvc140d.dll is the debug version (there's a d on the end). You can't redistribute these, you need to rebuild in release mode before putting it on your other computer. Then installing vc_redist.exe from the Microsoft website on your other computer should fix your problem.

Ezert

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Problem with MSVCP140d.dll
« Reply #3 on: June 05, 2019, 04:46:02 pm »
Firstly, thank you two for help.

I'll also note that msvc140d.dll is the debug version (there's a d on the end). You can't redistribute these, you need to rebuild in release mode before putting it on your other computer. Then installing vc_redist.exe from the Microsoft website on your other computer should fix your problem.

I need to install vc_reddist.exe in every computer I send my program? :/
I chose to static link SFML to make my program simple...
There is no other way to fix it?


I believe that to be the Visual Studio C++ runtime. It's the core C++ code and is needed to run any Visual Studio program.
To be clear, I presume you are statically linking SFML. You can, also, however, statically link the C++ core runtime. This is separate from statically linking SFML although you should also build SFML with the correct flag for doing so.

I tried to statically link C++ as you told me, but now, for some reason, the building doesn't work! A lot of linking errors appears...
This is the tutorial I followed to static link C++: https://linustechtips.com/main/topic/622425-how-to-configure-static-linking-in-visual-studio/
What could I do next?

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problem with MSVCP140d.dll
« Reply #4 on: June 05, 2019, 06:01:35 pm »
If you statically link the core/standard C++ libraries then SFML needs to be built with that in mind so you will need to build SFML yourself.
In CMake, you probably want the SFML_USE_STATIC_STD_LIBS option.


Quote from: CMake tutorial linked above
This boolean option [(SFML_USE_STATIC_STD_LIBS)] selects the type of the C/C++ runtime library which is linked to SFML.
TRUE statically links the standard libraries, which means that SFML is self-contained and doesn't depend on the compiler's specific DLLs.
FALSE (the default) dynamically links the standard libraries, which means that SFML depends on the compiler's DLLs (msvcrxx.dll/msvcpxx.dll for Visual C++, libgcc_s_xxx-1.dll/libstdc++-6.dll for GCC). Be careful when setting this. The setting must match your own project's setting or else your application may fail to run.
This option should not be enabled simultaneously with BUILD_SHARED_LIBS, they are mutually exclusive.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Ezert

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Problem with MSVCP140d.dll
« Reply #5 on: June 05, 2019, 10:02:27 pm »
If you statically link the core/standard C++ libraries then SFML needs to be built with that in mind so you will need to build SFML yourself.
Ok. I'll try it.
But let me know something: everybody needs to do it, or it is specific for my computer?
« Last Edit: June 06, 2019, 07:07:21 pm by Ezert »

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Problem with MSVCP140d.dll
« Reply #6 on: June 06, 2019, 08:44:24 pm »
As far as I'm aware, it's not that common for SFML users to statically link the Visual Studio runtime.

People tend to be fine with distributing DLLs and the like. You should be aware that there are AAA games that first require you to have the Visual Studio runtime installed.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything