Boost C++ Libraries: Ticket #6797: Undefined references for program_options library with mingw64. https://svn.boost.org/trac10/ticket/6797 <p> I compiled a shared version of boost program_options with mingw64. When I try to link against it I get: </p> <pre class="wiki">Linking CXX executable ..\..\..\binary\abc.exe CMakeFiles\abc.dir/objects.a(test.cpp.obj):test.cpp:(.text+0x65bf): undefined reference to `boost::program_options::detail::common_config_file_iterator::c ommon_config_file_iterator(std::set&lt;std::string, std::less&lt;std::string&gt;, std::allocator&lt;std::string&gt; &gt; const&amp;, bool)' CMakeFiles\abc.dir/objects.a(test.cpp.obj):test.cpp:(.text+0x6672): undefined reference to `boost::program_options::detail::common_config_file_iterator::g et()' CMakeFiles\abc.dir/objects.a(test.cpp.obj):test.cpp:(.text+0x7871): undefined reference to `boost::program_options::detail::common_config_file_iterator::g et()' collect2: ld returned 1 exit status </pre><p> I use cmake for my project and everything works fine under linux. nm gives the following output: </p> <pre class="wiki">$ nm libboost_program_options.dll | grep common_config_file_iterator 000000006e1a62c0 d .data$_ZTIN5boost12eof_iteratorINS_15program_options6detail27common_config_file_iteratorENS1_12basic_optionIcEEEE 000000006e1a62e0 d .data$_ZTIN5boost15iterator_facadeINS_15program_options6detail27common_config_file_iteratorEKNS1_12basic_optionIcEENS_21forward_traversal_tag ERS6_xEE 000000006e1a6660 d .data$_ZTIN5boost15program_options6detail27common_config_file_iteratorE 000000006e1a96a0 d .data$_ZTVN5boost15program_options6detail27common_config_file_iteratorE 000000006e1b578c p .pdata$_ZN5boost15program_options6detail27common_config_file_iterator7getlineERSs 000000006e1b58d0 p .pdata$_ZN5boost15program_options6detail27common_config_file_iteratorD0Ev 000000006e1b58c4 p .pdata$_ZN5boost15program_options6detail27common_config_file_iteratorD1Ev 000000006e1b5d38 p .pdata$_ZN5boost15program_options6detail27common_config_file_iteratorD2Ev 000000006e1b18e0 r .rdata$_ZTSN5boost12eof_iteratorINS_15program_options6detail27common_config_file_iteratorENS1_12basic_optionIcEEEE 000000006e1b1960 r .rdata$_ZTSN5boost15iterator_facadeINS_15program_options6detail27common_config_file_iteratorEKNS1_12basic_optionIcEENS_21forward_traversal_ta gERS6_xEE 000000006e1b20e0 r .rdata$_ZTSN5boost15program_options6detail27common_config_file_iteratorE 000000006e108c20 t .text$_ZN5boost15program_options6detail27common_config_file_iterator7getlineERSs 000000006e108c30 t .text$_ZN5boost15program_options6detail27common_config_file_iteratorD0Ev 000000006e108e00 t .text$_ZN5boost15program_options6detail27common_config_file_iteratorD1Ev 000000006e108fc0 t .text$_ZN5boost15program_options6detail27common_config_file_iteratorD2Ev 000000006e1be600 r .xdata$_ZN5boost15program_options6detail27common_config_file_iterator7getlineERSs 000000006e1be74c r .xdata$_ZN5boost15program_options6detail27common_config_file_iteratorD0Ev 000000006e1be740 r .xdata$_ZN5boost15program_options6detail27common_config_file_iteratorD1Ev 000000006e1beadc r .xdata$_ZN5boost15program_options6detail27common_config_file_iteratorD2Ev 000000006e198fe0 t _GLOBAL__sub_I__ZN5boost15program_options6detail27common_config_file_iteratorC2ERKSt3setISsSt4lessISsESaISsEEb 000000006e0cd800 T _ZN5boost15program_options6detail27common_config_file_iterator10add_optionEPKc 000000006e0cde20 T _ZN5boost15program_options6detail27common_config_file_iterator3getEv U _ZN5boost15program_options6detail27common_config_file_iterator7getlineERSs 000000006e108c20 T _ZN5boost15program_options6detail27common_config_file_iterator7getlineERSs 000000006e0ceda0 T _ZN5boost15program_options6detail27common_config_file_iteratorC1ERKSt3setISsSt4lessISsESaISsEEb 000000006e0da700 t _ZN5boost15program_options6detail27common_config_file_iteratorC2ERKS2_.constprop.235 000000006e0ceda0 T _ZN5boost15program_options6detail27common_config_file_iteratorC2ERKSt3setISsSt4lessISsESaISsEEb 000000006e108c30 T _ZN5boost15program_options6detail27common_config_file_iteratorD0Ev U _ZN5boost15program_options6detail27common_config_file_iteratorD0Ev U _ZN5boost15program_options6detail27common_config_file_iteratorD1Ev 000000006e108e00 T _ZN5boost15program_options6detail27common_config_file_iteratorD1Ev 000000006e108fc0 T _ZN5boost15program_options6detail27common_config_file_iteratorD2Ev 000000006e0cd660 T _ZNK5boost15program_options6detail27common_config_file_iterator14allowed_optionERKSs 000000006e1a62c0 D _ZTIN5boost12eof_iteratorINS_15program_options6detail27common_config_file_iteratorENS1_12basic_optionIcEEEE 000000006e1a62e0 D _ZTIN5boost15iterator_facadeINS_15program_options6detail27common_config_file_iteratorEKNS1_12basic_optionIcEENS_21forward_traversal_tagERS6_x EE 000000006e1a6660 D _ZTIN5boost15program_options6detail27common_config_file_iteratorE 000000006e1b18e0 R _ZTSN5boost12eof_iteratorINS_15program_options6detail27common_config_file_iteratorENS1_12basic_optionIcEEEE 000000006e1b1960 R _ZTSN5boost15iterator_facadeINS_15program_options6detail27common_config_file_iteratorEKNS1_12basic_optionIcEENS_21forward_traversal_tagERS6_x EE 000000006e1b20e0 R _ZTSN5boost15program_options6detail27common_config_file_iteratorE 000000006e1a96a0 D _ZTVN5boost15program_options6detail27common_config_file_iteratorE </pre><p> The command I use to build boost is: </p> <pre class="wiki">b2 --toolset=gcc variant=release address-model=64 threading=multi optimization=speed link=shared runtime-link=shared cxxflags='-DBOOST_USE_WINDOWS_H -std=gnu++0x -march=core2 -mtune=core2 -msse -msse2 -mssse3 -msse4' --with-thread --with-dat e_time --with-filesystem --with-program_options --prefix=c:/temp/boost install </pre><p> I attach a minimal cmake project (I used Boost 1.48.0 there, but it makes no difference). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6797 Trac 1.4.3 tasptz@… Mon, 16 Apr 2012 08:48:53 GMT attachment set https://svn.boost.org/trac10/ticket/6797 https://svn.boost.org/trac10/ticket/6797 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">po.zip</span> </li> </ul> Ticket anonymous Mon, 16 Apr 2012 08:49:28 GMT <link>https://svn.boost.org/trac10/ticket/6797#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6797#comment:1</guid> <description> <p> In the attached project the boost headers are missing (file size limitation). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 19 Dec 2013 01:58:19 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6797#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6797#comment:2</guid> <description> <p> as your comment, the built libs on linux is working, but fails to work on windows, i think this is because of the common_config_file_iterator' export. </p> <p> i add this fix, and it works on windows with .dll suffix: </p> <p> class <strong>BOOST_PROGRAM_OPTIONS_DECL</strong> common_config_file_iterator </p> <blockquote> <p> : public eof_iterator&lt;common_config_file_iterator, option&gt; </p> </blockquote> <blockquote> <p> { </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Thu, 19 Dec 2013 04:19:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6797#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6797#comment:3</guid> <description> <p> I've checked in a fix: <a class="ext-link" href="https://github.com/boostorg/program_options/commit/4ae33ce15e5b6345e6eefa19466fdf7cd28a7bbd"><span class="icon">​</span>https://github.com/boostorg/program_options/commit/4ae33ce15e5b6345e6eefa19466fdf7cd28a7bbd</a> </p> <p> Thanks for your patience. </p> </description> <category>Ticket</category> </item> <item> <author>dani@…</author> <pubDate>Wed, 08 Jan 2014 16:17:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6797#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6797#comment:4</guid> <description> <p> <a class="ext-link" href="https://github.com/boostorg/program_options/pull/1"><span class="icon">​</span>https://github.com/boostorg/program_options/pull/1</a> fixes compilation failures on (at least) vc10, vc11, and vc12 introduced with commit 4ae33ce. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>mlt</dc:creator> <pubDate>Fri, 05 Jun 2015 19:54:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6797#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6797#comment:5</guid> <description> <p> I'm surprised it didn't make it into 1.58. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Tue, 09 Jun 2015 07:05:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6797#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6797#comment:6</guid> <description> <p> I would expect this to be part of 1.59: <a class="ext-link" href="https://github.com/boostorg/program_options/commit/fae2d4c57b6c70e19e00cd6b93f4ef4f4c6681e2"><span class="icon">​</span>https://github.com/boostorg/program_options/commit/fae2d4c57b6c70e19e00cd6b93f4ef4f4c6681e2</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>