简体   繁体   中英

How to include ICU library in Qt project in Ubuntu?

I need to include International Components for Unicode library in Qt Creator, here is my .pro file:

TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
CONFIG += icu

SOURCES += main.cpp

Where from can I download this library ? I already did

sudo apt-get install libicu-dev

What should I add in my .pro file to use this include in main.cpp ? : This code gives me an error:

#include <unicode/unistr.h>

int main(int argc, char** argv) {
        UnicodeString ucs;

Error: undefined reference to `icu_55::StringPiece::StringPiece(char const*)'

In normal case you can use icu after "dev" package installed. But in that case icu will not integrated into Qt. Just separated libraries.

You can try rebuild Qt libraries. When run ./configure Add appropriate flags to that command:

  1. -icu ................. Enable ICU support [auto]
  2. -webengine-icu ....... Select used ICU libraries [system/qt] (Linux only)

Think after your installation of libicu-dev , that flags will automatically turn on. Just check ./configure output.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM