Boost C++ Libraries: Ticket #532: multi_index/detail/unbounded.hpp causes problems in MSVC PCH https://svn.boost.org/trac10/ticket/532 <pre class="wiki">MSVC 7.1 I integrated a multi_index into my project and have been very happy with it. However, compile times for my class went from milliseconds to five seconds. And since this class is a cornerstone of my project, this time got added to each compile. To try and speed things up, I put this particular class's header file in my precompiled header system. Well, that worked great, everything compiles fast, but when it links, there are two static objects defined in every object file, causing conflicts, so it doesn't link. The errors are the same this guy got. http://lists.boost.org/boost-users/2004/07/7151.php What I tried and what works for me, but I'm not sure is an acceptable long-term solution, was to #define out two lines which to my eyes appear to define static objects. Why this is only a problem for pre-compiled headers, I don't know. Anyway, here is what I did to unbounded.hpp #if !defined(_MSC_VER) namespace{ detail::unbounded_type unbounded_obj=detail::unbounded_type(); detail::unbounded_type&amp; unbounded=unbounded_obj; } /* unnamed */ #endif </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/532 Trac 1.4.3 joaquintides Mon, 12 Dec 2005 08:41:49 GMT <link>https://svn.boost.org/trac10/ticket/532#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/532#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=911241 I have just reproduced the problem you mention, after googling a bit seems like a known bug of MSVC when mixing unnamed namespace entities and PCHs. The solution you propose is not valid, since it undefines unbounded, which can be used in the range() member function of ordered indices. Could you please try replacing your local copy of boost/multi_index/detail/unbounded.hpp with the file attached? My tests show this fixes the problem, I'll be commiting this to the CVS after some regression tests. Best, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>dsmtoday</dc:creator> <pubDate>Mon, 12 Dec 2005 15:52:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/532#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/532#comment:2</guid> <description> <pre class="wiki">Logged In: YES user_id=1040827 Joaquín - Thanks for the quick reply. Your new file worked for me. No more link errors when I use the multi_index template in a pre-compiled header. Thanks again for the prompt fix! -todd- </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>joaquintides</dc:creator> <pubDate>Mon, 12 Dec 2005 17:31:08 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/532#comment:3 https://svn.boost.org/trac10/ticket/532#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=911241 Fixed in CVS. Hope you're enjoying Boost.MultiIndex! </pre> Ticket askldjd Wed, 07 Feb 2007 04:12:11 GMT <link>https://svn.boost.org/trac10/ticket/532#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/532#comment:4</guid> <description> <pre class="wiki">Logged In: YES user_id=1712657 Originator: NO I have encountered the same issue. I had also tried your solution, and it works great. Would this bug be fixed for Boost 1.34 release? Thank. ... Alan </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>joaquintides</dc:creator> <pubDate>Wed, 07 Feb 2007 07:07:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/532#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/532#comment:5</guid> <description> <pre class="wiki">Logged In: YES user_id=911241 Originator: NO Hello Alan, Yes, this problem is fixed in what will (hopefully soon) become Boost 1.34. You can check it yourself by downloading a RC_1_34 snapshot from http://engineering.meta-comm.com/boost/snapshot/boost-RC_1_34_0.tar.bz2 Best regards, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo </pre> </description> <category>Ticket</category> </item> </channel> </rss>