Boost logo

Boost Users :

From: Dinesh Pillay (dpillay_at_[hidden])
Date: 2005-06-07 03:40:09


Hello all,

I'm really new to boost and I tried compiling and then linking the
following program :

#include <iostream>
#include <boost/any.hpp>

int main()
{
       boost::any a = 8;

       int var = boost::any_cast<int>(a);

       std::cout << var << std::endl;

       system("pause");
       return 0;
}

I am able to compile the file with the command:
>g++ -IC:\Boost\include\boost-1_32 -pedantic -s -O3 -fno-exceptions -c
boost_trial.cpp -o boost_trial.o

But when I try to link the file using:
g++ -IC:\Boost\include\boost-1_32 boost_trial.cpp -o boost_trial.exe

I get the following errors:

/mingw/lib/libstdc++.a(eh_personality.o)(.data$_ZTISt9exception[typeinfo
for std::exception]+0x0): multiple definition of `typeinfo for
std::exception'
C:\DOCUME~1\dpilla\LOCALS~1\Temp/ccoBaaaa.o(.rdata$_ZTISt9exception[typeinfo
for std::exception]+0x0):boost_trial.cpp: first defined here
/mingw/lib/libstdc++.a(eh_personality.o)(.text$_ZTSSt9exception[typeinfo
name for std::exception]+0x0): multiple definition of `typeinfo name
for std::exception'
C:\DOCUME~1\dpilla\LOCALS~1\Temp/ccoBaaaa.o(.rdata$_ZTSSt9exception[typeinfo
name for std::exception]+0x0):boost_trial.cpp: first defined here
/mingw/lib/libstdc++.a(functexcept.o)(.data$_ZTISt8bad_cast[typeinfo
for std::bad_cast]+0x0): multiple definition of `typeinfo for
std::bad_cast'
C:\DOCUME~1\dpilla\LOCALS~1\Temp/ccoBaaaa.o(.rdata$_ZTISt8bad_cast[typeinfo
for std::bad_cast]+0x0):boost_trial.cpp: first defined here
/mingw/lib/libstdc++.a(functexcept.o)(.text$_ZTSSt8bad_cast[typeinfo
name for std::bad_cast]+0x0): multiple definition of `typeinfo name
for std::bad_cast'
C:\DOCUME~1\dpilla\LOCALS~1\Temp/ccoBaaaa.o(.rdata$_ZTSSt8bad_cast[typeinfo
name for std::bad_cast]+0x0):boost_trial.cpp: first defined here
collect2: ld returned 1 exit status

I have no idea why this is happening! What am I doing wrong? Somebody
please tell me the right way to link the file.

Thanks a million.

Regards,
Dinesh Pillay.

--
 - Perfection or Nothing.

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