Boost logo

Boost Users :

From: Raider (sraider_at_[hidden])
Date: 2006-04-14 03:16:32


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_at_utf8_codecvt_facet_at_detail@program_options_at_boost@@MBEHAAHPBG1AAPBGPAD3AAPAD_at_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_at_utf8_codecvt_facet_at_detail@program_options_at_boost@@MBEHAAHPBD1AAPBDPAG3AAPAG_at_Z)

As a linker tells me the reference is:
?do_in_at_utf8_codecvt_facet_at_detail@program_options_at_boost@@MBEHAAHPBD1AAPBDPAG3AAPAG_at_Z

But library (auto-linked libboost_program_options-vc71-sgd-1_33_1.lib)
contains:
?do_in_at_utf8_codecvt_facet_at_detail@program_options_at_boost@@MBEHAAHPBD1AAPBDPA_W3AAPA_W_at_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_at_utf8_codecvt_facet_at_detail@program_options_at_boost@@MBEHAAHPBD1AAPBDPAG3AAPAG_at_Z
export or to build code above with some options to get
?do_in_at_utf8_codecvt_facet_at_detail@program_options_at_boost@@MBEHAAHPBD1AAPBDPA_W3AAPA_W_at_Z
reference?


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