When trying to compile Audacity in MSVC++ Express Edition 2008. I know,
the wiki said, "The safest bet is the earlier version called MSVC++
Express 2005", but who am I to follow directions... :-D. I already had
2008 installed and didn't want to go back. So having everything else
spot on with the recommendations, I tried it anyway. Well every thing
worked except for 3 projects (librdf, raptor, rasqal) with a lot of
repeated errors...
D:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\include\stdio.h(358) : error C3163: '_vsnprintf': attributes
inconsistent with previous declaration
D:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\include\stdio.h(350) : see declaration of '_vsnprintf'
Well snooping around the code, I found a #define in each of the
projects' include files that set vsnprintf to _vsnprintf. According to
some searches on the internet it would look like Microsoft decided to
use the standard form of vsnprintf starting with VS9 and Express Ed.
2008, thus causing the confusion with inconsistent attributes. Many
projects have that same #define line, and solutions are to remove the
line completely or to use _MSC_VER to determine whether use it or not.
I think the latter would be preferred. Since it has been working in the
past, the definition should remain the same, but to get rid of the
errors for current and future versions of MSVC++.
The only part of the code that is affected is logging from the libraries
to stderr when their debug macros are defined, so in a non-console
environment it would have no impact at all, but the code has a callback
mechanism that could use another call to vsnprintf that could be used
for proper logging. All three header files at the top say they are
"WIN32 hard-coded config" files, so patching them directly should be the
correct thing to do.
Solution: if _MSC_VER is not defined OR _MSC_VER is less than 1500
(before VS9 and Ed. 2008), it should do the define as it originally has,
otherwise do nothing. I know I could get away with leaving out the
check for the lack of defined _MSC_VER, but I wanted to avoid any
warnings like gcc's -Wundef equivalent in MSVC++ now or in the future.
The 32-bit compilation (debug and release) works for me on Windows XP
x64 and compiling the changes in Linux (64-bit) is running just the same
as before.
Please review my three patches, let me know if it should be done
differently or if there are any problems. Any critiques are welcome [ I
can take it ;-) ].
Thanks,
Dawson
Index: win/Projects/raptor/win32_raptor_config.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/win/Projects/raptor/win32_raptor_config.h,v
retrieving revision 1.1
diff -u -r1.1 win32_raptor_config.h
--- win/Projects/raptor/win32_raptor_config.h 11 Jul 2008 04:51:51 -0000 1.1
+++ win/Projects/raptor/win32_raptor_config.h 13 Sep 2008 00:10:45 -0000
@@ -71,7 +71,9 @@
#define HAVE_STRICMP 1
/* MS names for these functions */
+#if !defined _MSC_VER || _MSC_VER < 1500
#define vsnprintf _vsnprintf
+#endif
#define snprintf _snprintf
#define access _access
#define stricmp _stricmp
Index: win/Projects/rasqal/win32_rasqal_config.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/win/Projects/rasqal/win32_rasqal_config.h,v
retrieving revision 1.1
diff -u -r1.1 win32_rasqal_config.h
--- win/Projects/rasqal/win32_rasqal_config.h 11 Jul 2008 04:51:54 -0000 1.1
+++ win/Projects/rasqal/win32_rasqal_config.h 13 Sep 2008 00:11:13 -0000
@@ -40,7 +40,9 @@
#define HAVE_STRICMP 1
/* MS names for these functions */
+#if !defined _MSC_VER || _MSC_VER < 1500
#define vsnprintf _vsnprintf
+#endif
#define snprintf _snprintf
#define access _access
#define stricmp _stricmp
Index: lib-src/redland/librdf/win32_rdf_config.h
===================================================================
RCS file: /cvsroot/audacity/lib-src/redland/librdf/win32_rdf_config.h,v
retrieving revision 1.1
diff -u -r1.1 win32_rdf_config.h
--- lib-src/redland/librdf/win32_rdf_config.h 8 Jul 2008 10:40:30 -0000 1.1
+++ lib-src/redland/librdf/win32_rdf_config.h 13 Sep 2008 00:09:41 -0000
@@ -43,7 +43,9 @@
#define HAVE_STRICMP 1
/* MS names for these functions */
+#if !defined _MSC_VER || _MSC_VER < 1500
#define vsnprintf _vsnprintf
+#endif
#define snprintf _snprintf
#define access _access
#define stricmp _stricmp
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
audacity-devel mailing list
audacity-devel@...
https://lists.sourceforge.net/lists/listinfo/audacity-devel