I'm making a text-based game, using ICU to process game text from UTF-8-encoded JSON files across the 3 major PC platforms. I'm able to compile and link the game binary with CMake while referencing ICU types such as UChar, UnicodeString, etc. and everything works properly. Bizarrely enough, there are certain headers from which I can't access any types or functions without causing an "Undefined symbols" linker error. Particularly, the header "ustdio.h" from which I need to access u_fopen(), u_fclose(), u_fgets(), etc. to extract unicode strings from my JSON files.
Undefined symbols for architecture x86_64: "_u_fclose_57", referenced from: FileReader::Close() in libsource.a(FileReader.cpp.o) "_u_fgets_57", referenced from: FileReader::HasNextLine() in libsource.a(FileReader.cpp.o) FileReader::NextLine() in libsource.a(FileReader.cpp.o) "_u_fopen_57", referenced from: FileReader::FileReader(std::__1::basic_string, std::__1::allocator >) in libsource.a(FileReader.cpp.o)
I'm using this CMake module file to locate the .h
and .dylib
files. From CMake output, I know it's linking against /usr/local/lib/libicuuc.dylib
, but looking in that folder I also see plenty of other ICU-related dylibs. Another programmer directed me to check if the symbols I'm looking for are really defined in the dylib
using nm
and I can see in the symbol list that they aren't. Am I to assume these symbols are defined in one of the other dylib
files? If they are, and I find the proper dylib
, how do I modify FindICU.cmake
to link against the extra dynamic library? The module seems really obtuse to me and I don't know where I'd change it to fix this.