0

Embarcadero Berlin 10.1 で簡単なコンソール アプリケーションを作成し、32 ビットの clang コンパイラを選択して、boost docs の hereからいくつかのコードをコピーしました。

ここに完全なコードがあります

#pragma hdrstop
#pragma argsused

#ifdef _WIN32
#include <tchar.h>
#else
  typedef char _TCHAR;
  #define _tmain main
#endif

#include <stdio.h>

#include <boost/locale.hpp>

int _tmain(int argc, _TCHAR* argv[]) 
{
    using namespace boost::locale;
    using namespace std;
    generator gen;
    locale loc=gen("");
    // Create system default locale

    locale::global(loc);
    // Make it system global

    cout.imbue(loc);
    // Set as default locale for output

    cout <<format("Today {1,date} at {1,time} we had run our first localization example") % time(0)
      <<endl;

    cout<<"This is how we show numbers in this locale "<<as::number << 103.34 <<endl;
    cout<<"This is how we show currency in this locale "<<as::currency << 103.34 <<endl;
    cout<<"This is typical date in the locale "<<as::date << std::time(0) <<endl;
    cout<<"This is typical time in the locale "<<as::time << std::time(0) <<endl;
    cout<<"This is upper case "<<to_upper("Hello World!")<<endl;
    cout<<"This is lower case "<<to_lower("Hello World!")<<endl;
    cout<<"This is title case "<<to_title("Hello World!")<<endl;
    cout<<"This is fold case "<<fold_case("Hello World!")<<endl;

    return 0;
}

しかし、いくつかのリンカー エラーが発生します。

[ilink32 Error] Error: Unresolved external 'boost::system::generic_category()' referenced from C:\PROGRAM FILES (X86)\EMBARCADERO\STUDIO\18.0\LIB\WIN32C\RELEASE\LIBBOOST_LOCALE-BCB32C-MT-SD-1_55.LIB|generator
[ilink32 Error] Error: Unresolved external 'boost::system::system_category()' referenced from C:\PROGRAM FILES (X86)\EMBARCADERO\STUDIO\18.0\LIB\WIN32C\RELEASE\LIBBOOST_LOCALE-BCB32C-MT-SD-1_55.LIB|generator
[ilink32 Error] Error: Unresolved external 'boost::locale::impl_win::create_convert(std::locale&, boost::locale::impl_win::winlocale&, unsigned int)' referenced from C:\PROGRAM FILES (X86)\EMBARCADERO\STUDIO\18.0\LIB\WIN32C\RELEASE\LIBBOOST_LOCALE-BCB32C-MT-SD-1_55.LIB|win_backend
[ilink32 Error] Error: Unresolved external 'boost::locale::impl_win::create_collate(std::locale&, boost::locale::impl_win::winlocale&, unsigned int)' referenced from C:\PROGRAM FILES (X86)\EMBARCADERO\STUDIO\18.0\LIB\WIN32C\RELEASE\LIBBOOST_LOCALE-BCB32C-MT-SD-1_55.LIB|win_backend
[ilink32 Error] Error: Unresolved external 'boost::locale::impl_win::create_formatting(std::locale&, boost::locale::impl_win::winlocale&, unsigned int)' referenced from C:\PROGRAM FILES (X86)\EMBARCADERO\STUDIO\18.0\LIB\WIN32C\RELEASE\LIBBOOST_LOCALE-BCB32C-MT-SD-1_55.LIB|win_backend
[ilink32 Error] Error: Unresolved external 'boost::locale::impl_win::create_parsing(std::locale&, boost::locale::impl_win::winlocale&, unsigned int)' referenced from C:\PROGRAM FILES (X86)\EMBARCADERO\STUDIO\18.0\LIB\WIN32C\RELEASE\LIBBOOST_LOCALE-BCB32C-MT-SD-1_55.LIB|win_backend

libboost_locale-bcb32c-MT-SD-1_55.lib をプロジェクトに手動で追加することで修正できる最初の 2 つです。Boost に関する私の理解と経験から、実際には手動でリンクする必要はありませんが、気にしません。ただし、最後の4つはまったくわかりません。ロケール バックエンドに関連しているようです (Embarcadero が提供するブーストを備えた ICU ではありませんか?)

誰かアドバイスはありますか?

4

1 に答える 1

1

あなたの問題は私にとって非常に興味深いものです。だから私は新しいプロジェクトを作成し、あなたのコードをそれにコピーしましたが、問題が繰り返されたことを確認してください。
いくつかの調査を行った後、この問題を克服できた唯一の方法は、プロジェクトにcollate.cppandconverter.cppを追加することでした。また、関数の前にソース コードに追加する必要がありました。numeric.cpp$(BDSINCLUDE)\boost_1_55\libs\locale\src\win32#pragma link "libboost_system-bcb32c-mt-sd-1_55.lib"main

サム

于 2016-09-07T21:54:46.893 に答える