Trying Boost under Ubuntu but fail

L

Lambda

Hi All,

I'm trying Boost in my Ubuntu machine for the first time.
It's a simple code that use tuple.

But when I g++ it, it says:
tuple: no such file or directory

I installed boost 1.33.1, I proved it with apt-get install

What should I do? I need boost 1.34?
 
Z

Zeppe

Lambda said:
Hi All,

I'm trying Boost in my Ubuntu machine for the first time.
It's a simple code that use tuple.

But when I g++ it, it says:
tuple: no such file or directory

I installed boost 1.33.1, I proved it with apt-get install

What should I do? I need boost 1.34?

Even if your message were intopic, if you don't provide the source code
and the compiler command line there is no possibility to help you out.
Probably you didn't include the boost directory in your include path.

Regards,

Zeppe
 
L

Lambda

Even if your message were intopic, if you don't provide the source code
and the compiler command line there is no possibility to help you out.
Probably you didn't include the boost directory in your include path.

Regards,

Zeppe

#include <tuple>
#include <iostream>
#include <utility>
using std::cout;
using std::pair; using std::make_pair;
using std::tr1::tuple; using std::tr1::make_tuple;
using std::tr1::get;

int main()
{
pair<int, double> pr = make_pair(1, 2.1);
cout << pr.first << ", " << pr.second << '\n';
tuple<int, double, long> tp = make_tuple(1, 2.1, 3);
cout << get<0>(tp) << ", " << get<1>(tp)
<< ", " << get<2>(tp) << '\n';

return 0;
}
 
L

Lambda

#include <tuple>
#include <iostream>
#include <utility>
using std::cout;
using std::pair; using std::make_pair;
using std::tr1::tuple; using std::tr1::make_tuple;
using std::tr1::get;

int main()
{
pair<int, double> pr = make_pair(1, 2.1);
cout << pr.first << ", " << pr.second << '\n';
tuple<int, double, long> tp = make_tuple(1, 2.1, 3);
cout << get<0>(tp) << ", " << get<1>(tp)
<< ", " << get<2>(tp) << '\n';

return 0;

}

I compile with:

g++ tuple.cc

Need I help g++ to find the lib?
 
U

utab

I compile with:

g++ tuple.cc

Need I help g++ to find the lib?


See the boost documentation, as far as I can see, the first place to
start is

#include "boost/tuple/tuple.hpp"

not <tuple>
Rgds,
 
Z

Zeppe

there is no such a file. If you give a look to your /usr/include, that
is the dir in your include path by default, there is a folder for boost.
you need


this is not a prt of the standard. tuple, make_tuple and get are boost
components, and are in the boost namespace:

using boost::tuple;
... etc.
I compile with:

g++ tuple.cc

Need I help g++ to find the lib?

there is no lib file because the entire library is inilne ni the header.

Note that all I wrote is in the manual. Check it out at
http://www.boost.org/libs/tuple/doc/tuple_users_guide.html

Regards,

Zeppe
 
P

Pete Becker

this is not a prt of the standard. tuple, make_tuple and get are boost
components, and are in the boost namespace:

They're not part of the standard, but they're part of TR1. Boost says
it's got the TR1 headers (I haven't checked), so this should work.
Note that all I wrote is in the manual. Check it out at
http://www.boost.org/libs/tuple/doc/tuple_users_guide.html

Or check Boost's documentation for their implementation of TR1.
 
C

Cholo Lennon

L

Lambda

there is no such a file. If you give a look to your /usr/include, that
is the dir in your include path by default, there is a folder for boost.
you need



this is not a prt of the standard. tuple, make_tuple and get are boost
components, and are in the boost namespace:

using boost::tuple;
.. etc.









there is no lib file because the entire library is inilne ni the header.

Note that all I wrote is in the manual. Check it out athttp://www.boost.org/libs/tuple/doc/tuple_users_guide.html

Regards,

Zeppe

I changed the header and the namespace, it works now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,038
Members
47,633
Latest member
BriannaLyk

Latest Threads

Top