I'm trying to use MSVC to compile a C program with the Flite text-to-speech library, but I'm getting unresolved external symbol errors.
I started with the "C Example" from the Flite docs but they use gcc. I was able to get rid of some errors by linking ws2_32.lib and legacy_stdio_definitions.lib but I can't find a solution to the remaining ones.
Do I just need to use a different compiler, or is there some solution that will allow me to use MSVC?
main.c
#include "flite.h"
register_cmu_us_kal();
int main(int argc, char **argv)
{
cst_voice *v;
if (argc != 2)
{
fprintf(stderr, "usage: flite_test FILE\n");
exit(-1);
}
flite_init();
v = register_cmu_us_kal(NULL);
flite_file_to_speech(argv[1], v, "play");
}
build.bat
cl ..\src\main.c -I "../lib/Flite/include/" /link ws2_32.lib legacy_stdio_definitions.lib /LIBPATH:"../lib/Flite/lib" libflite_cmu_us_kal.a libflite_usenglish.a libflite_cmulex.a libflite.a
Result
build.bat
Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26128 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
..\src\main.c(17): warning C4047: '=': 'cst_voice *' differs in levels of indirection from 'int'
Microsoft (R) Incremental Linker Version 14.13.26128.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
ws2_32.lib
legacy_stdio_definitions.lib
/LIBPATH:../lib/Flite/lib
libflite_cmu_us_kal.a
libflite_usenglish.a
libflite_cmulex.a
libflite.a
main.obj
libflite_usenglish.a(us_expand.o) : error LNK2019: unresolved external symbol __locale_ctype_ptr referenced in function en_exp_letters
libflite.a(cst_string.o) : error LNK2001: unresolved external symbol __locale_ctype_ptr
libflite.a(regexp.o) : error LNK2001: unresolved external symbol __locale_ctype_ptr
libflite.a(cst_lexicon.o) : error LNK2019: unresolved external symbol __getreent referenced in function cst_lex_make_entry
libflite.a(cst_error.o) : error LNK2001: unresolved external symbol __getreent
libflite.a(cst_tokenstream.o) : error LNK2001: unresolved external symbol __getreent
libflite.a(cst_mmap_posix.o) : error LNK2019: unresolved external symbol getpagesize referenced in function cst_mmap_file
libflite.a(cst_mmap_posix.o) : error LNK2019: unresolved external symbol mmap referenced in function cst_mmap_file
libflite.a(cst_mmap_posix.o) : error LNK2019: unresolved external symbol munmap referenced in function cst_munmap_file
libflite.a(au_oss.o) : error LNK2019: unresolved external symbol ioctl referenced in function audio_open_oss
main.exe : fatal error LNK1120: 6 unresolved externals