プログラムでギリシャ文字を出力できるようにしたいと考えています。ICU をインストールしてリンクしましたが、Unicode 文字列を標準出力に出力する方法がわかりません。簡単なコードを次に示します。
#include <unicode/unistr.h>
#include <unicode/ustring.h>
#include <unicode/ustream.h>
#include <iostream>
int main() {
UnicodeString mystr("αβγ");
std::cout << mystr << std::endl;
}
でコンパイルするg++ ./ctest.cpp -licui18n -licuuc -licudata -lpthread -lm
と、次のエラーが発生します。
ctest.cpp:(.text+0x27): `icu_46::operator<<(std::basic_ostream >&, icu_46::UnicodeString const&)' への未定義の参照
collect2: ld が 1 つの終了ステータスを返しました
ICU のドキュメンテーションは、私のような素人にとっては難しく、特にustream.h
、私がやろうとしていることの鍵だと思う . どんな助けも歓迎します (特に、よりユーザーフレンドリーな ICU のガイドを書きたい人がいれば!)。