First of all ICU4C 72.1(latest version)
In continuation of my previous question i rewrote my code to use ICU, I dont want to use makefile for a time being. So I use Visual Studio Code compiler.
The problem is it doesn't seem to load libraires and I dont know why.
So those are my c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/icu-windows/include/**",
"${workspaceFolder}/icu-windows/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:/msys64/mingw64/bin/g++.exe",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "windows-gcc-x64"
}
],
"version": 4
}
and tasks.json
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe сборка активного файла",
"command": "C:/msys64/mingw64/bin/g++.exe",
"args": [
"-fdiagnostics-color=always",
"-IC:\\Users\\pasha\\Downloads\\NLP\\icu-windows\\include",
"-LC:\\Users\\pasha\\Downloads\\NLP\\icu-windows\\lib64",
"-g",
"${file}",
"-licuin",
"-licuuc",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"-Wno-multichar"
],
"options": {
"cwd": "C:/msys64/mingw64/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Created"
}
],
"version": "2.0.0"
}
whether
"-licuin",
"-licuuc",
are present or not i get this HUGE error message
C:/msys64/mingw64/bin/g++.exe -fdiagnostics-color=always -IC:\Users\pasha\Downloads\NLP\icu-windows\include -LC:\Users\pasha\Downloads\NLP\icu-windows\lib64 -g C:\Users\pasha\Downloads\NLP\main.cpp -o C:\Users\pasha\Downloads\NLP\main.exe -Wno-multichar
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\pasha\AppData\Local\Temp\ccDkbIOI.o: in function `normalise(icu_72::UnicodeString)':
C:/Users/pasha/Downloads/NLP/bpe.h:58: undefined reference to `icu_72::StringCharacterIterator::StringCharacterIterator(icu_72::UnicodeString const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/pasha/Downloads/NLP/bpe.h:60: undefined reference to `icu_72::UCharCharacterIterator::first32()'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/pasha/Downloads/NLP/bpe.h:60: undefined reference to `icu_72::UCharCharacterIterator::next32()'
...
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\pasha\AppData\Local\Temp\ccDkbIOI.o:main.cpp:(.rdata$.refptr._ZTVN6icu_7211ReplaceableE[.refptr._ZTVN6icu_7211ReplaceableE]+0x0): undefined reference to `vtable for icu_72::Replaceable'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\pasha\AppData\Local\Temp\ccDkbIOI.o:main.cpp:(.rdata$.refptr._ZTVN6icu_727UObjectE[.refptr._ZTVN6icu_727UObjectE]+0x0): undefined reference to `vtable for icu_72::UObject'
collect2.exe: error: ld returned 1 exit status
bin64 is included in the path.
UPD: The function
icu::UnicodeString normalise(icu::UnicodeString to_normalise)
{
std::unordered_map<UChar, UChar> char_map = {
{'_', ' '},
{'á', 'a'},
{'à', 'a'},
{'â', 'a'},
...
};
// Create an output string
icu::UnicodeString result;
icu::StringCharacterIterator iter(to_normalise);
// Loop over the input string
for (UChar32 c = iter.first32(); c != icu::StringCharacterIterator::DONE; c = iter.next32())
{
// If the character is in the map, replace it
if (char_map.count(c))
{
result += std::tolower(char_map[c]);
continue;
}
else if (std::isalpha(c))
{
// If the character is alphabetic, add it to the output string in lowercase
result += std::tolower(c);
continue;
}
else if (std::ispunct(c) || myn::isemoji(c))
{
result += c;
result += ' ';
continue;
}
else if (std::isspace(c))
{
result += c;
}
}
return result;
}