boost compilation error,plz help
Moderator: Oberlus
-
- Space Krill
- Posts: 5
- Joined: Fri Jan 16, 2009 12:20 pm
boost compilation error,plz help
Hi All,
I am trying to compile boost in ubuntu 7.10.
Here is the path of installation in my pc
bijay@cmp1:~/boost$ locate libboost_filesystem
/usr/lib/libboost_filesystem-gcc41-mt-1_34_1.so.1.34.1
/usr/lib/libboost_filesystem-gcc42-1_34_1.so.1.34.1
/usr/lib/libboost_filesystem-gcc42-mt-1_34_1.so.1.34.1
/usr/lib/libboost_filesystem-gcc41-1_34_1.so.1.34.1
/var/cache/apt/archives/libboost_filesystem-gcc41-mt-1_34_1.so.1.34.1
/var/cache/apt/archives/libboost_filesystem-gcc42-1_34_1.so.1.34.1
/var/cache/apt/archives/libboost_filesystem-gcc42-mt-1_34_1.so.1.34.1
/var/cache/apt/archives/libboost_filesystem-gcc41-1_34_1.so.1.34.1
bijay@cmp1:~/boost$
when i try a program like bellow
#include <exception>
#include <boost/thread/thread.hpp>
#include <stdlib.h>
#include <iostream>
using namespace std;
class callable {
public:
void run()
{
try
{
cout << "Throwing" <<std:: endl;
throw string("error");
}
catch(string &e)
{
cout << "Error: " << e << endl;
}
}
void operator()() {
this->run();
}
};
int main() {
callable c;
cout<<"inside main"<<endl;
boost::thread thd(boost::ref(c));
thd.join();
return 0;
}
after compiling like
bijay@cmp1:~/boost$ g++ -o second boostThread.cpp -L/user/lib/libboost_filesystem-gcc42-1_34_1
it throws error like bellow
/tmp/ccv5r3IM.o: In function `main':
boostThread.cpp:(.text+0xeb): undefined reference to `boost::thread::thread(boost::function0<void, std::allocator<boost::function_base> > const&)'
boostThread.cpp:(.text+0x101): undefined reference to `boost::thread::join()'
boostThread.cpp:(.text+0x132): undefined reference to `boost::thread::~thread()'
boostThread.cpp:(.text+0x148): undefined reference to `boost::thread::~thread()'
collect2: ld returned 1 exit status
Please Please any one help me out.
Thanks in advance
Bijay Panda.
I am trying to compile boost in ubuntu 7.10.
Here is the path of installation in my pc
bijay@cmp1:~/boost$ locate libboost_filesystem
/usr/lib/libboost_filesystem-gcc41-mt-1_34_1.so.1.34.1
/usr/lib/libboost_filesystem-gcc42-1_34_1.so.1.34.1
/usr/lib/libboost_filesystem-gcc42-mt-1_34_1.so.1.34.1
/usr/lib/libboost_filesystem-gcc41-1_34_1.so.1.34.1
/var/cache/apt/archives/libboost_filesystem-gcc41-mt-1_34_1.so.1.34.1
/var/cache/apt/archives/libboost_filesystem-gcc42-1_34_1.so.1.34.1
/var/cache/apt/archives/libboost_filesystem-gcc42-mt-1_34_1.so.1.34.1
/var/cache/apt/archives/libboost_filesystem-gcc41-1_34_1.so.1.34.1
bijay@cmp1:~/boost$
when i try a program like bellow
#include <exception>
#include <boost/thread/thread.hpp>
#include <stdlib.h>
#include <iostream>
using namespace std;
class callable {
public:
void run()
{
try
{
cout << "Throwing" <<std:: endl;
throw string("error");
}
catch(string &e)
{
cout << "Error: " << e << endl;
}
}
void operator()() {
this->run();
}
};
int main() {
callable c;
cout<<"inside main"<<endl;
boost::thread thd(boost::ref(c));
thd.join();
return 0;
}
after compiling like
bijay@cmp1:~/boost$ g++ -o second boostThread.cpp -L/user/lib/libboost_filesystem-gcc42-1_34_1
it throws error like bellow
/tmp/ccv5r3IM.o: In function `main':
boostThread.cpp:(.text+0xeb): undefined reference to `boost::thread::thread(boost::function0<void, std::allocator<boost::function_base> > const&)'
boostThread.cpp:(.text+0x101): undefined reference to `boost::thread::join()'
boostThread.cpp:(.text+0x132): undefined reference to `boost::thread::~thread()'
boostThread.cpp:(.text+0x148): undefined reference to `boost::thread::~thread()'
collect2: ld returned 1 exit status
Please Please any one help me out.
Thanks in advance
Bijay Panda.
Re: boost compilation error,plz help
Upgrade ubuntu to 8.10. You have boost 1.34, which is out of date. And continue compiling by wiki howto.
Re: boost compilation error,plz help
It's possible to get it all up and running on your distro, if you choose not upgrading, but it can be quite a lot of work. If available packages doesn't have high enough version numbers go for compiling and installing the newer ones from source. Almost all *-devel and *-lib packages can perfectly well coexist in different versions on the same system.bijay_panda wrote:Hi All,
I am trying to compile boost in ubuntu 7.10.
...
Please Please any one help me out.
Thanks in advance
Bijay Panda.
To get better separation from packages that come with your system you might still want to install in another location (/usr/local/lib and /usr/local/include) than where your standard packages usually gets installed (/lib, /usr/lib and /usr/include).
Try running "./configure --help" etc. in source packages to get a list of install options and locations before compiling and installing.
M.
Re: boost compilation error,plz help
The problem ist that libboost_filesystem is not enough to link or maybe even the wrong lib. I think you need libboost_thread instead of libboost_filesystem, as you are using threads and not filesystems.
-
- Space Krill
- Posts: 5
- Joined: Fri Jan 16, 2009 12:20 pm
Re: boost compilation error,plz help
Hi,
I already installed the library in all of the path bellow.
/user/local/lib
/user/local/include
/user/lib
Still the same error it's showing.
I already installed the library in all of the path bellow.
/user/local/lib
/user/local/include
/user/lib
Still the same error it's showing.
stride wrote:It's possible to get it all up and running on your distro, if you choose not upgrading, but it can be quite a lot of work. If available packages doesn't have high enough version numbers go for compiling and installing the newer ones from source. Almost all *-devel and *-lib packages can perfectly well coexist in different versions on the same system.bijay_panda wrote:Hi All,
I am trying to compile boost in ubuntu 7.10.
...
Please Please any one help me out.
Thanks in advance
Bijay Panda.
To get better separation from packages that come with your system you might still want to install in another location (/usr/local/lib and /usr/local/include) than where your standard packages usually gets installed (/lib, /usr/lib and /usr/include).
Try running "./configure --help" etc. in source packages to get a list of install options and locations before compiling and installing.
M.
-
- Space Krill
- Posts: 5
- Joined: Fri Jan 16, 2009 12:20 pm
Re: boost compilation error,plz help
Hi,
I did that but the same error.I am not getting the what linking problem it's getting.
all the libraries are there in these path
/user/lib
/user/local/lib
/user/local/include
bijay@cmp1:~/boost$ g++ -o second boostThread.cpp -L/user/lib/libboost_thread-mt.so
/tmp/ccLrbfvL.o: In function `main':
boostThread.cpp:(.text+0xeb): undefined reference to `boost::thread::thread(boost::function0<void, std::allocator<boost::function_base> > const&)'
boostThread.cpp:(.text+0x101): undefined reference to `boost::thread::join()'
boostThread.cpp:(.text+0x132): undefined reference to `boost::thread::~thread()'
boostThread.cpp:(.text+0x148): undefined reference to `boost::thread::~thread()'
collect2: ld returned 1 exit status
bijay@cmp1:~/boost$
Just have a look at it plz plz plz.
I did that but the same error.I am not getting the what linking problem it's getting.
all the libraries are there in these path
/user/lib
/user/local/lib
/user/local/include
bijay@cmp1:~/boost$ g++ -o second boostThread.cpp -L/user/lib/libboost_thread-mt.so
/tmp/ccLrbfvL.o: In function `main':
boostThread.cpp:(.text+0xeb): undefined reference to `boost::thread::thread(boost::function0<void, std::allocator<boost::function_base> > const&)'
boostThread.cpp:(.text+0x101): undefined reference to `boost::thread::join()'
boostThread.cpp:(.text+0x132): undefined reference to `boost::thread::~thread()'
boostThread.cpp:(.text+0x148): undefined reference to `boost::thread::~thread()'
collect2: ld returned 1 exit status
bijay@cmp1:~/boost$
Just have a look at it plz plz plz.
kroddn wrote:The problem ist that libboost_filesystem is not enough to link or maybe even the wrong lib. I think you need libboost_thread instead of libboost_filesystem, as you are using threads and not filesystems.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: boost compilation error,plz help
You're not building boost properly. Go the the boost site and read their getting started guide. I believe you need to use boost.jam.
Re: boost compilation error,plz help
You are not using it the right way.
Try
-L defines a search path for libs
-l defines one lib to link the program with. This must be specified WITHOUT .so suffix.
Its not a good idea to start with working on boost if you don't know how to work with g++ commands. Maybe you should start with gcc tutorials and/or Makefiles.
Try
Code: Select all
g++ -o second boostThread.cpp -L/user/lib/ -llibboost_thread-mt
-l defines one lib to link the program with. This must be specified WITHOUT .so suffix.
Its not a good idea to start with working on boost if you don't know how to work with g++ commands. Maybe you should start with gcc tutorials and/or Makefiles.
Re: boost compilation error,plz help
Also... beware that when compiling and installing boost "out of the box" with standard configuration; the names of libraries will include your compiler and threading info in them, like this:bijay_panda wrote:Hi,
I did that but the same error.I am not getting the what linking problem it's getting.
all the libraries are there in these path
/user/lib
/user/local/lib
/user/local/include
Code: Select all
/usr/local/lib/libboost_date_time-gcc40-mt-1_37.a
/usr/local/lib/libboost_date_time-gcc40-mt-1_37.so
/usr/local/lib/libboost_date_time-gcc40-mt-1_37.so.1.37.0
/usr/local/lib/libboost_date_time-gcc40-mt.a
/usr/local/lib/libboost_date_time-gcc40-mt.so
/usr/local/lib/libboost_filesystem-gcc40-mt-1_37.a
/usr/local/lib/libboost_filesystem-gcc40-mt-1_37.so
/usr/local/lib/libboost_filesystem-gcc40-mt-1_37.so.1.37.0
/usr/local/lib/libboost_filesystem-gcc40-mt.a
/usr/local/lib/libboost_filesystem-gcc40-mt.so
/usr/local/lib/libboost_graph-gcc40-mt-1_37.a
/usr/local/lib/libboost_graph-gcc40-mt-1_37.so
/usr/local/lib/libboost_graph-gcc40-mt-1_37.so.1.37.0
/usr/local/lib/libboost_graph-gcc40-mt.a
/usr/local/lib/libboost_graph-gcc40-mt.so
Last edited by Geoff the Medio on Tue Jan 20, 2009 10:37 am, edited 1 time in total.
Reason: fixed url BBCode
Reason: fixed url BBCode