Boost C++ Libraries: Ticket #10688: Fusion vector error when using Qt https://svn.boost.org/trac10/ticket/10688 <p> My code compiles fine until I added fusion to the project. I later found out that it is conflicting with the moc file used by Qt. I've attached an example to show this problem. </p> <p> /usr/include/boost/fusion/container/vector/vector.hpp:25: Error: '#' is not followed by a macro parameter AUTOGEN: error: process for /home/work/daikin/dahmi/build/src/app/main.moc failed: /usr/include/boost/fusion/container/vector/vector.hpp:25: Error: '#' is not followed by a macro parameter </p> <p> moc failed... src/app/CMakeFiles/dahmi_automoc.dir/build.make:49: recipe for target 'src/app/CMakeFiles/dahmi_automoc' failed make<a class="changeset" href="https://svn.boost.org/trac10/changeset/2" title="Add Boost Disclaimer">[2]</a>: <strong>* [src/app/CMakeFiles/dahmi_automoc] Error 1 CMakeFiles/Makefile2:367: recipe for target 'src/app/CMakeFiles/dahmi_automoc.dir/all' failed make<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a>: </strong>* [src/app/CMakeFiles/dahmi_automoc.dir/all] Error 2 make<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a>: <strong>* Waiting for unfinished jobs.... /usr/include/boost/fusion/container/vector/vector.hpp:25: Error: '#' is not followed by a macro parameter AUTOGEN: error: process for /home/work/daikin/dahmi/build/src/lib/qml/moc_qml.cpp failed: /usr/include/boost/fusion/container/vector/vector.hpp:25: Error: '#' is not followed by a macro parameter </strong></p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10688 Trac 1.4.3 rlayman2000@… Thu, 23 Oct 2014 13:25:57 GMT attachment set https://svn.boost.org/trac10/ticket/10688 https://svn.boost.org/trac10/ticket/10688 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">fusion_error.tar.gz</span> </li> </ul> <p> demonstrates the fusion error when using with qt </p> Ticket rlayman2000@… Mon, 27 Oct 2014 13:36:29 GMT attachment set https://svn.boost.org/trac10/ticket/10688 https://svn.boost.org/trac10/ticket/10688 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">fusion_qt_error.tar.gz</span> </li> </ul> <p> This is a stripped down version of the previous attachment that demonstrates the bug </p> Ticket rlayman2000@… Mon, 27 Oct 2014 16:24:48 GMT <link>https://svn.boost.org/trac10/ticket/10688#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10688#comment:1</guid> <description> <p> Just including a moc file, generated by CMake, to a source file that includes a fusion vector.hpp is enough to get this error. On the provided example, removing vector.hpp or the include for the moc file will allow the program to compile. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Mon, 27 Oct 2014 23:57:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10688#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10688#comment:2</guid> <description> <p> I don't use QT. Can you provide a complete cpp file with the MOC? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jürgen Hunold</dc:creator> <pubDate>Tue, 28 Oct 2014 06:49:02 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10688#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10688#comment:3</guid> <description> <p> This is not a fusion bug. Qt's moc has an incomplete c++ parser. Please report such bugs to Qt so they can "fix" their parser. </p> <p> Workaround: </p> <p> Put "#ifndef Q_MOC_RUN" around the fusion includes. moc will then skip the includes. </p> <pre class="wiki">diff --git INDEX:/src/main.cpp WORKDIR:/src/main.cpp index 3a8f0a8..7fe69c1 100755 --- INDEX:/src/main.cpp +++ WORKDIR:/src/main.cpp @@ -1,5 +1,8 @@ #include &lt;iostream&gt; + +#ifndef Q_MOC_RUN #include &lt;boost/fusion/include/vector.hpp&gt; +#endif int main (int argc, char *argv[]) { </pre> </description> <category>Ticket</category> </item> <item> <author>rlayman2000@…</author> <pubDate>Tue, 28 Oct 2014 11:32:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10688#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10688#comment:4</guid> <description> <p> I was starting to think that was the case too. I'll file a bug report with Qt then. Thanks for the help. </p> </description> <category>Ticket</category> </item> <item> <author>Kohei Takahashi <flast@…></author> <pubDate>Sat, 14 Mar 2015 15:08:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10688#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10688#comment:5</guid> <description> <p> Joel, please close this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Fri, 12 Jun 2015 06:51:30 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10688#comment:6 https://svn.boost.org/trac10/ticket/10688#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> Ticket