utf8_codecvt_facet linking problem with VC 7.1

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

utf8_codecvt_facet linking problem with VC 7.1

Dmitry Vinogradov
I'm trying to compile simple code using utf8_codecvt_facet:

// ---- UTF8.cpp starts ------------------------------
#include <iostream>
#include <fstream>
#include <string>
#include <locale>

#include <boost/program_options/detail/utf8_codecvt_facet.hpp>

using namespace std;

int main()
{
        locale loc;
        locale utf8loc(loc,
          new boost::program_options::detail::utf8_codecvt_facet());
        wifstream f;
        f.imbue(utf8loc);
        f.open("UTF8.txt", ios::binary);
        wstring s;
        f >> s;
        f.close();

        return 0;
}
// ---- UTF8.cpp ends ------------------------------

It works OK with VC 8.0 (both building Boost and this code with VC 8.0).

But I get linker errors with VC 7.1 (both building Boost and this code
with VC 7.1):

UFT8.obj : error LNK2001: unresolved external symbol "protected: virtual
int __thiscall
boost::program_options::detail::utf8_codecvt_facet::do_out(int
&,unsigned short const *,unsigned short const *,unsigned short const *
&,char *,char *,char * &)const "
(?do_out@utf8_codecvt_facet@detail@program_options@boost@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z)

UFT8.obj : error LNK2001: unresolved external symbol "protected: virtual
int __thiscall
boost::program_options::detail::utf8_codecvt_facet::do_in(int &,char
const *,char const *,char const * &,unsigned short *,unsigned short
*,unsigned short * &)const "
(?do_in@utf8_codecvt_facet@detail@program_options@boost@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z)


As a linker tells me the reference is:
?do_in@utf8_codecvt_facet@detail@program_options@boost@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z

But library (auto-linked libboost_program_options-vc71-sgd-1_33_1.lib)
contains:
?do_in@utf8_codecvt_facet@detail@program_options@boost@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z

When I add Boost/libs/program_options/src/utf8_codecvt_facet.cpp to my
VC 7.1 project, the sample code builds fine.

The question is how to build this code under VC 7.1?
Is it needed to rebuild Boost's
libboost_program_options-vc71-*-1_33_1.lib with some compiler options to get
?do_in@utf8_codecvt_facet@detail@program_options@boost@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z
export or to build code above with some options to get
?do_in@utf8_codecvt_facet@detail@program_options@boost@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z
reference?

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users