Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created December 13, 2011 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save springmeyer/1474002 to your computer and use it in GitHub Desktop.
Save springmeyer/1474002 to your computer and use it in GitHub Desktop.
test icu's Collator::createInstance
# *** this fails ***
BUILD="/opt/icu4_8"
export DYLD_LIBRARY_PATH=/opt/icu4_8/lib
export ARCH_FLAGS="-arch x86_64 -arch i386"
export CFLAGS=$ARCH_FLAGS
export CXXFLAGS=$CFLAGS
export LDFLAGS=$ARCH_FLAGS
./runConfigureICU MacOSX --prefix=${BUILD} && make -j6 && make install
clang++ -o icutest icutest.cpp -I${BUILD}/include/ -L${BUILD}/lib -licuuc -licui18n
./icutest
en_US
Collator failed to initialize
#include <unicode/utypes.h>
#include <unicode/uchar.h>
#include <unicode/coll.h>
#include <iostream>
#include <iomanip>
int main()
{
U_NAMESPACE_QUALIFIER Locale l;
std::cout << l.getName() << std::endl;
UErrorCode success = U_ZERO_ERROR;
U_NAMESPACE_QUALIFIER Collator* pcol = U_NAMESPACE_QUALIFIER Collator::createInstance(l, success);
if(U_SUCCESS(success) == 0)
{
std::cout << "Collator failed to initialize" << std::endl;
exit(1);
}
return 0;
}
# *** this works ***
BUILD="/opt/icu4_8"
export DYLD_LIBRARY_PATH=/opt/icu4_8/lib
export ARCH_FLAGS="-arch x86_64"
export CFLAGS=$ARCH_FLAGS
export CXXFLAGS=$CFLAGS
export LDFLAGS=$ARCH_FLAGS
./runConfigureICU MacOSX --prefix=${BUILD} && make -j6 && make install
clang++ -o icutest icutest.cpp -I${BUILD}/include/ -L${BUILD}/lib -licuuc -licui18n
en_US
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment