Error compiling DCMTK from source in MinGW-w64 GCC-8.1.0 "Error: 'FlsAlloc' was not declared in this scope"

Error compiling DCMTK from source in MinGW-w64 GCC-8.1.0 "Error: 'FlsAlloc' was not declared in this scope"

我正在尝试编译 DCMTK from the source through MinGW32-w64 和 Cmake。

我在 mingw32-make 命令后收到这些错误:

In file included from C:/dcmtk/oflog/include/dcmtk/oflog/internal/internal.h:59,
                 from C:\Users\Rodrigo\Downloads\tmp_dcmtk\dcmtk\oflog\libsrc\oflog.cc:35:
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h: In function 'dcmtk::log4cplus::thread::impl::tls_key_type dcmtk::log4cplus::thread::impl::tls_init(PFLS_CALLBACK_FUNCTION)':
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:127:12: error: 'FlsAlloc' was not declared in this scope
     return FlsAlloc(cleanupfunc);
            ^~~~~~~~
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:127:12: note: suggested alternative: 'TlsAlloc'
     return FlsAlloc(cleanupfunc);
            ^~~~~~~~
            TlsAlloc
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h: In function 'void* dcmtk::log4cplus::thread::impl::tls_get_value(dcmtk::log4cplus::thread::impl::tls_key_type)':
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:137:12: error: 'FlsGetValue' was not declared in this scope
     return FlsGetValue(k);
            ^~~~~~~~~~~
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:137:12: note: suggested alternative: 'TlsGetValue'
     return FlsGetValue(k);
            ^~~~~~~~~~~
            TlsGetValue
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h: In function 'void dcmtk::log4cplus::thread::impl::tls_set_value(dcmtk::log4cplus::thread::impl::tls_key_type, dcmtk::log4cplus::thread::impl::tls_value_type)':
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:148:5: error: 'FlsSetValue' was not declared in this scope
     FlsSetValue(k, value);
     ^~~~~~~~~~~
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:148:5: note: suggested alternative: 'TlsSetValue'
     FlsSetValue(k, value);
     ^~~~~~~~~~~
     TlsSetValue
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h: In function 'void dcmtk::log4cplus::thread::impl::tls_cleanup(dcmtk::log4cplus::thread::impl::tls_key_type)':
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:159:5: error: 'FlsFree' was not declared in this scope
     FlsFree(k);
     ^~~~~~~
C:/dcmtk/oflog/include/dcmtk/oflog/thread/impl/tls.h:159:5: note: suggested alternative: 'TlsFree'
     FlsFree(k);
     ^~~~~~~
     TlsFree
mingw32-make[2]: *** [oflog\libsrc\CMakeFiles\oflog.dir\build.make:80: oflog/libsrc/CMakeFiles/oflog.dir/oflog.cc.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:2533: oflog/libsrc/CMakeFiles/oflog.dir/all] Error 2
mingw32-make: *** [Makefile:157: all] Error 2

我发现这个 link 有类似的错误,但是没有提供解决方案。

有人知道怎么解决吗?

系统:

默认情况下,MinGW headers 不会使所有 Win32 API 函数可见。在 CMakeLists.txt 文件中添加类似 add_compile_definitions (_WIN32_WINNT=0x600) 的行,使 Vista 和更高版本的 API 可见。那应该可以修复您的编译。