Visual C++ does not seem to have snprinft
When compiling dlls/gdi/tests/metafile.c on line 1357 I get a warning C4013: "snprintf" is undefined. Looking around, it seems that snprinft is in fact _snprintf in Visual C++. I have found a define #if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF) #define snprintf _snprintf #endif in wine/port.h but it requires config.h and they don't appear in my Visual C++ system. What is the best way to address this problem? It seems to be fairly common but I have not found an example in a test. Jeff Latimer
Jeff L <lats(a)yless4u.com.au> writes:
When compiling dlls/gdi/tests/metafile.c on line 1357 I get a warning C4013: "snprintf" is undefined. Looking around, it seems that snprinft is in fact _snprintf in Visual C++. I have found a define
#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF) #define snprintf _snprintf #endif
in wine/port.h but it requires config.h and they don't appear in my Visual C++ system. What is the best way to address this problem? It seems to be fairly common but I have not found an example in a test.
Just replace it by sprintf, tests should be made as portable as possible. -- Alexandre Julliard julliard(a)winehq.org
On Fri, Sep 08, 2006 at 12:05:29AM +1000, Jeff L wrote:
#define snprintf _snprintf
Unfortunately the above isn't adequate, the windows _snprintf() isn't the same beast as the posix (or is it even part of C now?) snprintf() in particular: 1) _snprintf() returns -1 if the data wouldn't fit (not the number of bytes that would have been output). 2) _snprintf() doesn't always NUL terminate the output! In particular _snprintf(buf, 2, "ab" ) will set buf[0] = 'a', buf[1] = 'b', and return 2. Almost certainly not what the calling code expceted. David -- David Laight: david(a)l8s.co.uk
Jeff L wrote:
When compiling dlls/gdi/tests/metafile.c on line 1357 I get a warning C4013: "snprintf" is undefined. Looking around, it seems that snprinft is in fact _snprintf in Visual C++. I have found a define
#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF) #define snprintf _snprintf #endif
in wine/port.h but it requires config.h and they don't appear in my Visual C++ system. What is the best way to address this problem? It seems to be fairly common but I have not found an example in a test.
Jeff Latimer
`config.h' is a header that is automatically generated by the Bourne shell script `configure' at the top of the source directory. You will need to use a Bourne-compatable shell to run it (There's a port of Bash to Windows), and you will probably need to mess around with it to get it to work right, but make sure you use the 'export' command to export CC to cl.exe, MAKE to nmake.exe, and LD to link.exe Also set your PATH. If all goes well, you've done something that I myself haven't done but know how to do (which seems odd, but after a while, you get used to how the Bourne shell works) You're probably going to need a whole lot of UNIX utilities ported to Windows like sed, grep, and awk for configure to work, though... -- The real problem with C++ for kernel modules is: the language just sucks. -- Linus Torvalds
On 9/15/06, Segin <segin2005(a)gmail.com> wrote:
Jeff L wrote:
When compiling dlls/gdi/tests/metafile.c on line 1357 I get a warning C4013: "snprintf" is undefined. Looking around, it seems that snprinft is in fact _snprintf in Visual C++. I have found a define
#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF) #define snprintf _snprintf #endif
in wine/port.h but it requires config.h and they don't appear in my Visual C++ system. What is the best way to address this problem? It seems to be fairly common but I have not found an example in a test.
Jeff Latimer
`config.h' is a header that is automatically generated by the Bourne shell script `configure' at the top of the source directory. You will need to use a Bourne-compatable shell to run it (There's a port of Bash to Windows), and you will probably need to mess around with it to get it to work right, but make sure you use the 'export' command to export CC to cl.exe, MAKE to nmake.exe, and LD to link.exe
Also set your PATH.
If all goes well, you've done something that I myself haven't done but know how to do (which seems odd, but after a while, you get used to how the Bourne shell works)
You're probably going to need a whole lot of UNIX utilities ported to Windows like sed, grep, and awk for configure to work, though...
http://www.cygwin.com/ -- James Hawkins
--- Segin <segin2005(a)gmail.com> wrote:
Jeff L wrote:
When compiling dlls/gdi/tests/metafile.c on line 1357 I get a warning C4013: "snprintf" is undefined. Looking around, it seems that snprinft is in fact _snprintf in Visual C++. I have found a define
#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF) #define snprintf _snprintf #endif
in wine/port.h but it requires config.h and they don't appear in my Visual C++ system. What is the best way to address this problem? It seems to be fairly common but I have not found an example in a test.
Jeff Latimer
`config.h' is a header that is automatically generated by the Bourne shell script `configure' at the top of the source directory. You will need to use a Bourne-compatable shell to run it (There's a port of Bash to Windows), and you will probably need to mess around with it to get it to work right, but make sure you use the 'export' command to export CC to cl.exe, MAKE to nmake.exe, and LD to link.exe
Also set your PATH.
If all goes well, you've done something that I myself haven't done but know how to do (which seems odd, but after a while, you get used to how the Bourne shell works)
You're probably going to need a whole lot of UNIX utilities ported to Windows like sed, grep, and awk for configure to work, though...
get msys from www.mingw.org, it has a Windows bash and a number of utilities.
-- The real problem with C++ for kernel modules is: the language just sucks.
-- Linus Torvalds -- And instead of sticking to ANSI C, the Linux kernel uses all sorts of GCC-specific extensions. Apparently C isn't good enough either. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
participants (6)
-
Alexandre Julliard -
Damjan Jovanovic -
David Laight -
James Hawkins -
Jeff L -
Segin