boost library, hardtolink&compile, plz help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dear g++ programers:

  I download boost's 1_46_1, then try to compile a simple program copied from book(C++ Cookbook) page447, 12.1 Creating a Thread
--------------
// example 12-1. Creating a thread
#include <iostream>
#include </home/eric/boost1/boost_1_46_1/boost/thread/thread.hpp>
#include </home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp>

struct MyThreadFunc {
  void operator()() {
    // Do something long-running...
  }
} threadFun;

int main() {
  boost::thread myThread(threadFun);  // Create a thread that starts
                                      // running threadFun
  boost::thread::yield();             // give up the main thread's timeslice
                                      // so the child thread can get some work
                                      // done.

  // Go do some other work...

  myThread.join();            // The current (i.e., main) thread will wait
                              // for myThread to finish before it returns
}
---------------------------------------------------------------------
my g++ 4.4.3 's compile result is
---------------------
eric@eric-laptop:~/cppcookbook$ g++ example12-1.cpp
In file included from example12-1.cpp:3:
/home/eric/boost1/boost_1_46_1/boost/thread/thread.hpp:12:44: error: boost/thread/detail/platform.hpp: No such file or directory
/home/eric/boost1/boost_1_46_1/boost/thread/thread.hpp:19:2: error: #error "Boost threads unavailable on this platform"
/home/eric/boost1/boost_1_46_1/boost/thread/thread.hpp:22:42: error: boost/thread/detail/thread.hpp: No such file or directory
/home/eric/boost1/boost_1_46_1/boost/thread/thread.hpp:23:55: error: boost/thread/detail/thread_interruption.hpp: No such file or directory
/home/eric/boost1/boost_1_46_1/boost/thread/thread.hpp:24:48: error: boost/thread/detail/thread_group.hpp: No such file or directory
In file included from example12-1.cpp:4:
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:11:42: error: boost/thread/detail/config.hpp: No such file or directory
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:13:29: error: boost/cstdint.hpp: No such file or directory
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:14:40: error: boost/thread/thread_time.hpp: No such file or directory
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:15:53: error: boost/date_time/posix_time/conversion.hpp: No such file or directory
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:17:39: error: boost/config/abi_prefix.hpp: No such file or directory
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:90:39: error: boost/config/abi_suffix.hpp: No such file or directory
In file included from example12-1.cpp:4:
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:38: error: ?int_fast64_t? does not name a type
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:41: error: ?int_fast32_t? does not name a type
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:43: error: ?xtime_sec_t? does not name a type
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:44: error: ?xtime_nsec_t? does not name a type
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:46: error: expected type-specifier before ?system_time?
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:59: error: ?boost::get_xtime? declared as an ?inline? variable
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:59: error: ?system_time? is not a member of ?boost?
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:60: error: expected ?,? or ?;? before ?{? token
In file included from example12-1.cpp:4:
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp: In function ?int boost::xtime_get(boost::xtime*, int)?:
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:73: error: ?get_system_time? was not declared in this scope
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp: In function ?int boost::xtime_cmp(const boost::xtime&, const boost::xtime&)?:
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:82: error: ?const struct boost::xtime? has no member named ?sec?
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:82: error: ?const struct boost::xtime? has no member named ?sec?
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:83: error: ?const struct boost::xtime? has no member named ?nsec?
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:83: error: ?const struct boost::xtime? has no member named ?nsec?
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:85: error: ?const struct boost::xtime? has no member named ?sec?
/home/eric/boost1/boost_1_46_1/boost/thread/xtime.hpp:85: error: ?const struct boost::xtime? has no member named ?sec?
example12-1.cpp: In function ?int main()?:
example12-1.cpp:13: error: ?thread? is not a member of ?boost?
example12-1.cpp:13: error: expected ?;? before ?myThread?
example12-1.cpp:15: error: ?boost::thread? has not been declared
example12-1.cpp:21: error: ?myThread? was not declared in this scope
eric@eric-laptop:~/cppcookbook$
--------------------------------
so, plz help
is that boost.org's problem?
thx a lot in advance, Eric



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux