icu-cmake icon indicating copy to clipboard operation
icu-cmake copied to clipboard

"unresolved external symbol" errors

Open floppyhammer opened this issue 1 year ago • 5 comments

I did link it against the icu target, but I still got errors:

font.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl icu_72::UMemory::operator delete(void *)" (__imp_??3UMemory@icu_72@@SAXPEAX@Z) referenced in function "public: virtual void * __cdecl icu_72::StringByteSink<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::`scalar deleting destructor'(unsigned int)" (??_G?$StringByteSink@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@icu_72@@UEAAPEAXI@Z)
font.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl icu_72::ByteSink::ByteSink(void)" (__imp_??0ByteSink@icu_72@@QEAA@XZ) referenced in function "public: __cdecl icu_72::StringByteSink<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::StringByteSink<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,int)" (??0?$StringByteSink@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@icu_72@@QEAA@PEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
font.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl icu_72::ByteSink::~ByteSink(void)" (__imp_??1ByteSink@icu_72@@UEAA@XZ) referenced in function "int `public: __cdecl icu_72::StringByteSink<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::StringByteSink<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,int)'::`1'::dtor$0" (?dtor$0@?0???0?$StringByteSink@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@icu_72@@QEAA@PEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z@4HA)
font.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class icu_72::UnicodeString __cdecl icu_72::UnicodeString::tempSubString(int,int)const " (__imp_?tempSubString@UnicodeString@icu_72@@QEBA?AV12@HH@Z) referenced in function "public: class std::vector<struct Flint::Glyph,class std::allocator<struct Flint::Glyph> > __cdecl Flint::Font::get_glyphs(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum Flint::Language)" (?get_glyphs@Font@Flint@@QEAA?AV?$vector@UGlyph@Flint@@V?$allocator@UGlyph@Flint@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@W4Language@2@@Z)
font.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl icu_72::UnicodeString::toUTF8(class icu_72::ByteSink &)const " (__imp_?toUTF8@UnicodeString@icu_72@@QEBAXAEAVByteSink@2@@Z) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __cdecl icu_72::UnicodeString::toUTF8String<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)const " (??$toUTF8String@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@UnicodeString@icu_72@@QEBAAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAV23@@Z)
font.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl icu_72::UnicodeString::length(void)const " (__imp_?length@UnicodeString@icu_72@@QEBAHXZ) referenced in function "public: class std::vector<struct Flint::Glyph,class std::allocator<struct Flint::Glyph> > __cdecl Flint::Font::get_glyphs(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum Flint::Language)" (?get_glyphs@Font@Flint@@QEAA?AV?$vector@UGlyph@Flint@@V?$allocator@UGlyph@Flint@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@W4Language@2@@Z)
font.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: char16_t const * __cdecl icu_72::UnicodeString::getBuffer(void)const " (__imp_?getBuffer@UnicodeString@icu_72@@QEBAPEB_SXZ) referenced in function "public: class std::vector<struct Flint::Glyph,class std::allocator<struct Flint::Glyph> > __cdecl Flint::Font::get_glyphs(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum Flint::Language)" (?get_glyphs@Font@Flint@@QEAA?AV?$vector@UGlyph@Flint@@V?$allocator@UGlyph@Flint@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@W4Language@2@@Z)
font.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl icu_72::UnicodeString::UnicodeString(char16_t const *)" (__imp_??0UnicodeString@icu_72@@QEAA@PEB_S@Z) referenced in function "public: class std::vector<struct Flint::Glyph,class std::allocator<struct Flint::Glyph> > __cdecl Flint::Font::get_glyphs(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum Flint::Language)" (?get_glyphs@Font@Flint@@QEAA?AV?$vector@UGlyph@Flint@@V?$allocator@UGlyph@Flint@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@W4Language@2@@Z)
font.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl icu_72::UnicodeString::UnicodeString(char const *)" (__imp_??0UnicodeString@icu_72@@QEAA@PEBD@Z) referenced in function "public: class std::vector<struct Flint::Glyph,class std::allocator<struct Flint::Glyph> > __cdecl Flint::Font::get_glyphs(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum Flint::Language)" (?get_glyphs@Font@Flint@@QEAA?AV?$vector@UGlyph@Flint@@V?$allocator@UGlyph@Flint@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@W4Language@2@@Z)
font.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl icu_72::UnicodeString::~UnicodeString(void)" (__imp_??1UnicodeString@icu_72@@UEAA@XZ) referenced in function "public: class std::vector<struct Flint::Glyph,class std::allocator<struct Flint::Glyph> > __cdecl Flint::Font::get_glyphs(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum Flint::Language)" (?get_glyphs@Font@Flint@@QEAA?AV?$vector@UGlyph@Flint@@V?$allocator@UGlyph@Flint@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@W4Language@2@@Z)
font.cpp.obj : error LNK2001: unresolved external symbol "public: virtual char * __cdecl icu_72::ByteSink::GetAppendBuffer(int,int,char *,int,int *)" (?GetAppendBuffer@ByteSink@icu_72@@UEAAPEADHHPEADHPEAH@Z)
font.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl icu_72::ByteSink::Flush(void)" (?Flush@ByteSink@icu_72@@UEAAXXZ)

Am I missing something?

floppyhammer avatar Jan 12 '23 13:01 floppyhammer

Did you use the prebuilt binaries or did you set the BUILD_ICU option? The prebuilt binaries are built with mingw-w64 so they are most likely not compatible with Visual C.

kleest avatar Jan 21 '23 14:01 kleest

@kleest Yes, I set the BUILD_ICU option. I tried both ways, and none of them worked.

floppyhammer avatar Jan 23 '23 08:01 floppyhammer

Actually, icu-cmake was originally intended to be compatible with Unix environments, which means MinGW on Windows. That's why building should only work in a Unix-like environment since it uses the shipped configure shell script. This normally excludes MSVC. However, we could try to debug this issue. Besides that, there is vcpkg by Microsoft which is useful when using MSVC.

Could you post your CMake output that display compiler version, etc.?

kleest avatar Jan 29 '23 11:01 kleest

@kleest It's been a while since I tested it last time. I might have made some mistake then, as the prebuilt method (BUILD_ICU=OFF) actually works for me now. But when I set BUILD_ICU=ON, CMake always complains as follows

CMake Error at external/icu-cmake/cmake/BuildICU.cmake:37 (message):
  Cannot find patch utility.

The compiler version is MSVC v143. I forget how I got the link error, so I'm not able to provide the related CMake output.

floppyhammer avatar Feb 03 '23 09:02 floppyhammer

The patch utility is part of the Unix-like environment, e.g. MinGW.

kleest avatar Mar 14 '23 21:03 kleest