Opened 8 years ago

Closed 7 years ago

#10688 closed Bugs (invalid)

Fusion vector error when using Qt

Reported by: rlayman2000@… Owned by: Joel de Guzman
Milestone: To Be Determined Component: fusion
Version: Boost 1.56.0 Severity: Problem
Keywords: fusion, vector.hpp, qt Cc:

Description

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.

/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

moc failed... src/app/CMakeFiles/dahmi_automoc.dir/build.make:49: recipe for target 'src/app/CMakeFiles/dahmi_automoc' failed make[2]: * [src/app/CMakeFiles/dahmi_automoc] Error 1 CMakeFiles/Makefile2:367: recipe for target 'src/app/CMakeFiles/dahmi_automoc.dir/all' failed make[1]: * [src/app/CMakeFiles/dahmi_automoc.dir/all] Error 2 make[1]: * 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

Attachments (2)

fusion_error.tar.gz (2.6 KB ) - added by rlayman2000@… 8 years ago.
demonstrates the fusion error when using with qt
fusion_qt_error.tar.gz (1.5 KB ) - added by rlayman2000@… 8 years ago.
This is a stripped down version of the previous attachment that demonstrates the bug

Download all attachments as: .zip

Change History (8)

by rlayman2000@…, 8 years ago

Attachment: fusion_error.tar.gz added

demonstrates the fusion error when using with qt

by rlayman2000@…, 8 years ago

Attachment: fusion_qt_error.tar.gz added

This is a stripped down version of the previous attachment that demonstrates the bug

comment:1 by rlayman2000@…, 8 years ago

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.

comment:2 by Joel de Guzman, 8 years ago

I don't use QT. Can you provide a complete cpp file with the MOC?

comment:3 by Jürgen Hunold, 8 years ago

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.

Workaround:

Put "#ifndef Q_MOC_RUN" around the fusion includes. moc will then skip the includes.

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 <iostream>
+
+#ifndef Q_MOC_RUN
 #include <boost/fusion/include/vector.hpp>
+#endif
 
 int main (int argc, char *argv[])
 {

comment:4 by rlayman2000@…, 8 years ago

I was starting to think that was the case too. I'll file a bug report with Qt then. Thanks for the help.

comment:5 by Kohei Takahashi <flast@…>, 8 years ago

Joel, please close this.

comment:6 by Joel de Guzman, 7 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.