[Winpcap-bugs] "vsnprintf" - build error - fix/update suggestion

Gianluca Varenni gianluca.varenni at cacetech.com
Fri Feb 20 08:53:17 PST 2009


Sorry for not getting back to you earlier.

I haven't found time to install a copy of VS2008 and see what needs to be 
changed in order to solve the vsnprintf issue and validate your proposed 
patch...

Have a nice day
GV

----- Original Message ----- 
From: "James Rhodes" <james_rhodes at ciqual.com>
To: <winpcap-bugs at winpcap.org>
Sent: Monday, February 09, 2009 8:42 AM
Subject: Re: [Winpcap-bugs] "vsnprintf" - build error - fix/update 
suggestion


> Hi,
>
> Regarding irritating change to the MS compiler above...
>
> FWIW I believe that the correct approach for a formal change to cope with 
> this would be along the following lines (once the winpcap project starts 
> using/supporting MS VS C++ 2008 - though the change can be made at any 
> time)
>
> pcap-stdinc.h:
> =======================
> #if _MSC_VER < 1500
> #define vsnprintf _vsnprintf
> #endif
> =======================
> compiler version 1500 comes with "MS VS C++ 2008"
> other versions against release (non-exhaustive)
>  2005 is  1400
>  2003 is  1310
>  2002 is  1300
>  6.0  is  1200
>  4.2  is  1020
>
> (This file is only included in a WIN32 windows build (see pcap.h) so 
> _MSC_VER should be defined in that case, however one could add 
> 'defined(_MSC_VER) &&' for belt-and-braces protection)
>
> I'll add this note to the issue-ticket that I raised on the libpcap 
> project. Though clearly fixing/changing it is clearly (to me) within the 
> remit of winpcap project.
>
> cheers,
>    James.
>
>
> Gianluca Varenni wrote:
>> The samples for 4.0.2 do not support Visual Studio 2005/2008, albeit it 
>> should be rather easy to tweak the include/source files and have them 
>> compile.
>>
>> 4.1 beta5 samples should compile ok with Visual Studio 2005 (and I expect 
>> them to compile ok on 2008, although I haven't tried). What's the error 
>> message with 2008 (I suppose you are using this version of VS).
>>
>> Have a nice day
>> GV
>>
>> ----- Original Message ----- From: "James Rhodes" 
>> <james_rhodes at ciqual.com>
>> To: <winpcap-bugs at winpcap.org>
>> Sent: Wednesday, February 04, 2009 5:54 AM
>> Subject: [Winpcap-bugs] "vsnprintf" - build error in winpcap ver. 4.0.2 
>> built with MS Visual Studio C++
>>
>>
>>> Hi there,
>>>
>>> Most likely you have encountered this, but I couldn't find a reference 
>>> so I'll submit a bug.
>>>
>>> 1) I downloaded the winpcap development kit for 4.0.2
>>>
>>> 2) Loaded the examples into the the latest version of MS Visual Studio 
>>> C++ Express
>>>
>>> 3) Build gives error:
>>> --------------------------------------------------
>>>    Compiling...
>>> basic_dump.c
>>> c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(358) : 
>>> error C3163: '_vsnprintf': attributes inconsistent with previous 
>>> declaration
>>>         c:\program files\microsoft visual studio 
>>> 9.0\vc\include\stdio.h(350) : see declaration of '_vsnprintf'
>>> ---------------------------------------------------
>>>
>>> 4) A confilct exists in pcap-stdinc.h line 63 ("#define vsnprintf 
>>> _vsnprintf")
>>>
>>> 5) A (temporary) fix is to comment out that line.
>>>
>>> 6) A little dig around (with the aid of google) shows that MS has (in it 
>>> s latest release) decided to add it's own definition of 
>>> vsnprintf...which means that the supplied definition is not compatible 
>>> with that ver. of the MS tool.
>>>
>>> 7) Full fix conditional guard around define depending on whether the 
>>> symbol is already defined ???
>>>
>>> 8) Problem would seem to exist in ver. 4.1.beta5 as well
>>>
>>> Cheers,
>>>    James.
>>>
>>> _______________________________________________
>>> Winpcap-bugs mailing list
>>> Winpcap-bugs at winpcap.org
>>> https://www.winpcap.org/mailman/listinfo/winpcap-bugs
>>
>
>
> _______________________________________________
> Winpcap-bugs mailing list
> Winpcap-bugs at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-bugs 



More information about the Winpcap-bugs mailing list