尽管链接了库,ICU4C 在 VSCode 中不起作用

问题描述 投票:0回答:0

首先是ICU4C 72.1(最新版)

继续我之前的问题,我重写了我的代码以使用 ICU,我暂时不想使用 makefile。所以我使用 Visual Studio Code 编译器。

问题是它似乎没有加载库,我不知道为什么。

所以那些是 我的 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
}

和 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"
}

是否

                "-licuin",
                "-licuuc",

存在与否我收到这个巨大的错误消息

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 包含在路径中。

c++ visual-studio-code icu
© www.soinside.com 2019 - 2024. All rights reserved.