[Spice-devel] [vdagent-win V2 4/6] Fix Visual Studio compiler warning (sscanf/strcat)

Uri Lublin uril at redhat.com
Mon Oct 20 07:34:24 PDT 2014


On 10/15/2014 04:34 PM, Christophe Fergeau wrote:
> On Mon, Oct 13, 2014 at 05:26:17PM +0300, Uri Lublin wrote:
>> Finally got to give your suggestion a try.
>> My system is Fedora 20, with mingw32-headers-3.2.0-1.fc20.noarch installed.
>>
>> At first I was able to build with strcat_s, but the program failed to run on
>> Windows XP, claiming it was missing that function.
>> As you've mention sscanf_s needs to be declared in the src file, but the
>> program
>> failed to run on Windows XP, claiming it was missing that function. (This
>> should
>> probably be added to mingw's sec_api/string.h)
>> After playing with it, I was able to make it work, by linking with
>> -lmsvcr100
>> and installing "Microsoft Visual C++ 2010 redistributable (x86)" on the
>> Windows XP.
> But when building with vc++, you can use strcat_s without installing
> this runtime?

When compiled with Visual Studio:
If compiled in static mode (with C/C++ -> Code Generation -> Runtime 
Library  set to Multi-threaded  (/MT)) it works without installing the 
redistributable runtime dll.
If compiled in dynamic (DLL) mode (with Runtime Library flag above set 
to Multi-threaded DLL (/MD) it does not work, unless this runtime dll is 
installed.

By default spice vdagent-win is compiled with /MT in "Release" builds.


More information about the Spice-devel mailing list