|
Boost Users : |
From: Nishant Mittal (nishttal_at_[hidden])
Date: 2008-03-06 14:13:32
Thanks Volodya.
1) LD_LIBRARY_PATH solution worked but now when I run a.out, I get a
Segmentation fault.
My hello world code is...
#include <iostream>
#include <boost/thread/thread.hpp>
#include <boost/thread/xtime.hpp>
struct MyThreadFunc {
void operator( )( ) {
std::cout << "Hello World !!!" << std::endl;
}
} 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
}
Thanks in advance for your help
Nishant
-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Vladimir Prus
Sent: Thursday, March 06, 2008 2:00 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Please help: Getting started with Boost
Nishant Mittal wrote:
> I have a 64 bit red hat linux (also 64 bit) box.
>
>
> 1) I downloaded boost from
>
> boost_1_34_1.tar.bz2
>
<http://downloads.sourceforge.net/boost/boost_1_34_1.tar.bz2?modtime=1185241
> 108&big_mirror=0>
>
> 2) Unizipped and installed it (./configure , make install ) everything
> worked fine.
>
>
>
> Questions:
[Well, neither question is actually a question about Boost, but anyway]
> 1) How do I check if I now have the 64 bit version of boost?
file <any-library-file>
should produce output such as:
<library>: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
stripped
You can also use
readelf -h <any-library-file>
>
> 2) I see that all libraries were put into /usr/local/lib and I can
> compile my hello world code with the following command.
>
> * $ g++ hello.cpp -lboost_thread-gcc41-mt-1_34_1
>
> but when I try to run the created a.out file I get a file not found error
> msg.
>
> * $ ./a.out
>
> * ./a.out: error while loading shared libraries:
> libboost_thread-gcc41-mt-1_34_1.so.1.34.1: cannot open shared object file:
> No such file or directory
>
> I did an ldd and this is the output.
>
> $ ldd a.out
>
> libboost_thread-gcc41-mt-1_34_1.so.1.34.1 => not found
You should add /usr/local/lib to LD_LIBRARY_PATH environment variable.
- Volodya
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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