PDA

View Full Version : Howto use Qt with Boost ?



bilgenratte
1st October 2009, 13:50
Hello all,

I am using Qt on Windows with MinGW. I added boost library by using INCLUDEPATH in the .pro file and compiled the sample program from boost's Getting Started on Windows.

using namespace boost::lambda;
typedef std::istream_iterator<int> in;

std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );

Now I receive the errors:
error: `cin' is not a member of `std'
error: `cout' is not a member of `std'

Do namespaces std and boost interfere?
Can I find a tutorial howto use Qt with Boost somewhere?

scascio
1st October 2009, 14:19
There is no problem using std neither boost with Qt. Just a question of includes and link.

In your sample, be sure to include <iostream> and <algorithm>

bilgenratte
1st October 2009, 14:40
:o Ok, I focused so much on boost, that I forgot the includes, SORRY for that !!!

caduel
1st October 2009, 15:12
unless you want to use Boost.Signals, then you need to specify in your .pro file

CONFIG += no_keywords // for Boost.Signals

and use Q_SIGNALS, S_SLOTS, Q_EMIT etc instead of signals, slots, emit...

HTH