Visual Studio 2017 C++ Exe for any pc (linking vcruntime140.dll)

前端 未结 2 1431
囚心锁ツ
囚心锁ツ 2021-01-14 09:25

I\'m very new to GUI programming in c++, thus I don\'t have that much experience.

I created myself a GUI for my programm using the Visual Studio 2017 CRL package and

2条回答
  •  借酒劲吻你
    2021-01-14 09:58

    There's basically two options.

    The Standard in the industry is to ship the Visual Studio 20xx Runtime Redistributable Installer alongside your program, and have it run before anyone tries to run your program themselves, to make sure that the .dll files are installed onto the target computer.

    The other option is to change the way that the libraries are linked to the executable at compile-time. This is done with a flag in Visual Studio:

    Basically, you want to change the Runtime Library field to either say Multi-Threaded or Multi-Threaded Debug depending on whether you're in Release or Debug mode, as opposed to "Multi-Threaded DLL", which is the default.

    Note, however, that you need to make sure that every single library you're using was compiled the same way: if any of them were compiled using the DLL version of the Runtime Library, they'll interoperate with your code in funny ways, and the least of your problems will be that they'll need the DLLs installed anyways, defeating your effort.

    Naturally, that's not an issue if all your libraries are Header-Only, but if any of them have been compiled, then you'll need to recompile them using the correct settings.

提交回复
热议问题