GNOME Bugzilla – Bug 599002
Incorrect Macro Definition in sigc++config.h for MSVC
Last modified: 2010-07-08 12:56:47 UTC
Created attachment 145824 [details] The updated sigc++config.h I have tried to compile the 2.2.4.x versions of libsigc++ using the supplied project files for Visual C++ 2008. The library (DLL) itself compiled fine, but 10 of the test/sample programs did not compile (error C2951-illegal definition of templates in functors/slot.h and others). Going further to compile glibmm, the compilation failed due to the same errors, and I gave up trying to compile version 2.2.4.x and went back to version 2.2.3, as I did not find any difference in the functors/slot.h in 2.2.3 and 2.2.4.x. Later on, as I traced the code, it seems the supplied sigc++config.h had an incorrect macro definition in line 5-that is "#define SIGC_GCC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD 1", which causes the wrong template definition being picked up in adapter_trait.h, as that macro is checked before the "#define SIGC_MSVC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD 1" macro, which I believe is the correct macro to pick up the correct template definition in adapter_trait.h. So, I commented line 5 out, and the entire set of project files compiled, and as I guessed, glibmm successfully compiled against libsigc++ 2.2.4.2. The updated sigc++config.h is attached for reference-this fix applies for both MSVC2005 and MSVC2008 since the file is identical on both sides.
Agree! And with that patch, I can finally have codes compiled with this new version. Thanks.
Comment on attachment 145824 [details] The updated sigc++config.h Looks like the fix is already in git master, and all that is needed is a tarball release.
Yes, this seems to be the fix: 2009-10-26 Armin Burgmeier <armin@arbur.net> * sigc++config.h: Move the first five definitions to the !SIGC_MSC ifdef block, so MSVC does not see them and only uses the definitions from the SIGC_MSC block. This fixes the build with MSVC. We've had two tarball releases since then, so I guess this is no problem now.