|
Boost Users : |
Subject: [Boost-users] [Bind] binding a functor simple example - compiler error
From: Viter :O) (viter.rod_at_[hidden])
Date: 2010-05-27 07:01:26
I'm having problems to compile a simple example and I don't
Know what could it be the problem.
my main.cpp code is the following:
-- main.cpp -----------------------------------------------
#include <boost/bind.hpp>
#include <iostream>
int main() {
struct F {
int operator() (int a, int b) const { return a + b; }
};
F f;
std::cout << " f: " << boost::bind(f,1,2)() << std::endl;
return 0;
}
-----------------------------------------------------------
I have the boost headers folder in the relative path "../../include"
The command line i'm using to compile the file is
@ g++ -I../../include -c main.cpp -o obj/Release/main.o
but it returns the following error:
no matching function for call to `bind(main()::F&, int, int)'
I tried with 2 compilers but I get the same error from both:
gcc versión 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
gcc version 3.4.5 (mingw-vista special r3)
I'm using the Code::Blocks Editor and the MinGW compiler.
Coud you help me to compile this simple example?
Thanks a lot.
\/iter :O)
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net