Boost logo

Boost Users :

From: rgalek2002 (rfox_at_[hidden])
Date: 2002-05-31 12:53:57


Hi,

I am a new user of the boost libs, so sorry for the supid questions.
I am running into a compilation error while trying to compile listing
2 and listing 3 from Bill Kempf's article at
http://www.cuj.com/articles/2002/0205/0205a/0205a.htm, giving simple
usage examples of boost threads.

1.

When I compile listing 2, the compiler chokes on the lines

  boost::thread thrd1(count(1));
  boost::thread thrd2(count(2));

with the errors

listing2.C:27: no matching function for call to `count (int)'
listing2.C:28: no matching function for call to `count (int)'

As you can see in the listing online, count is defined as 'struct
count{...}'

Upon perusal of threah.hpp, I see that, indeed, the class thread
constructor is looking for a function, not a struct or class as count
is defined in this code. Am I missing something, or is the code in
error?

2.

In listing 2, I get the following errors when compiling:

listing3.C:29: no matching function for call to `bind ({unknown
type}, int)'
listing3.C:31: no matching function for call to `bind ({unknown
type}, int)'

This is in response to the lines:

  boost::thread thrd1(boost::bind(&count, 1));
  boost::thread thrd2(boost::bind(&count, 2));

Again, am I missing something or what? I have pasted the code
directly from the source as provided online.

TIA for your help

Richard


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