Error C2491: "definition of dllimport function not allowed" when building on Windows (CMake / MSVC)

Hi everyone,

I’m trying to build my project with platform = Windows using CMake and MSVC (Visual Studio 2022).
During the build process, I got the following error:

C:\ProgramData\cocos\editors\Creator\3.8.7\resources\resources\3d\engine\native\external\sources\unzip\unzip.cpp(1977,2): 
error C2491: 'cc::unzEndOfFile': definition of dllimport function not allowed 
[F:\Cocos\Project\Example\build\windows\proj\cocos_engine.vcxproj]

Build Log:
windows8-29-2025 15-20.log (gist.github_com/NguyenDuck/c9ef7656c5c66d4d3a6895a7ff7eb5c0)

Environment:

  • Windows 11 x64
  • Visual Studio 2022 (v17.14)
  • Cocos Creator 3.8.7
  • CMake build system

Did you use the command to compile the project? Could you show me the compilation commands?

Thats included in log file i provided.
This is command ran when i press Make button:

cmake --build "F:/Cocos/Project/Example/build/windows/proj" --config Debug -- -verbosity:quiet

We use a static library for zlib. If you defines ZLIB_SLL, and after defining ZLIB_SLL, you still need to define ZLIB_INTERNAL.