id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 11876,Boost.Graph conflicts with Qt's foreach macro,richel@…,Jeremiah Willcock,"This is a similar problem as https://svn.boost.org/trac/boost/ticket/6455, where the Qt `foreach` macro conflicts with the `boost::foreach::tag` in file `/usr/include/boost/foreach.hpp`. This is a simple Qt example that reproduces the error (also supplied as an attachment): {{{ #include #include #include #include #include int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); std::ofstream f(""filename.dot""); boost::write_graphviz( f, boost::adjacency_list<>() ); return a.exec(); } }}} For the following Qt Creator project file: {{{ QT += core QT -= gui CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp }}} The error given is: {{{ In file included from /usr/include/boost/graph/graphviz.hpp:35:0, from ../CppBoostGraphAndQtConflictQtConsole/main.cpp:5: /usr/include/boost/foreach.hpp:169:42: error: 'boost::Q_FOREACH::tag' has not been declared boost_foreach_is_lightweight_proxy(T *&, BOOST_FOREACH_TAG_DEFAULT) { return 0; } }}} The error does not occur if 'boost/graph/adjacency_list.hpp' is #included either before `QCoreApplication` or after. This is a workaround. I cannot see if this error is still present in later versions of Boost. If it is still present, I hope I have contributed in letting Boost.Graph and Qt work together seamlessly. ",Bugs,new,To Be Determined,graph,Boost 1.54.0,Problem,,Graph BGL Qt,