Those errors in the screenshot are coming from some issue with your CMake generated project, being either missing files or resources.
When you run CMake, check for any warnings or errors. Go into \win32build\CMakeFiles\
, and you’ll find the following files which you can open up and review for any problems:
CMakeError.log
and CMakeOutput.log
If you are using the default CMakeLists.txt in the root of your game, and you add new resources (like graphics etc), then you need to go into the win32build
folder, and delete CMakeLists.txt, then run the CMake command again to regenerate the Visual Studio solution files.
The alternative is to use a slightly modified CMakeLists.txt which no longer copies resources, but instead creates a symbolic link to them. The main benefit of this is that your Windows builds will be so much quicker (depending on how many resources you have).
Open up the root CMakeLists.txt
in your game project folder, then scroll down to the bottom, where you’ll see this section:
if(LINUX OR WINDOWS)
set(APP_RES_DIR "$<TARGET_FILE_DIR:${APP_NAME}>/Resources")
cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER})
endif()
Comment it out, and add this section instead:
if(LINUX OR WINDOWS)
set(APP_RES_DIR "$<TARGET_FILE_DIR:${APP_NAME}>/Resources")
add_custom_command(TARGET ${APP_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink ${GAME_RES_FOLDER} ${APP_RES_DIR})
endif()
(I can’t quite recall who originally posted this symbolic linking bit of CMake script, but it does really speed up development on Windows)
Just make sure you re-run CMake again. To make your life easier, add the following to a batch file, put it in your game project folder, and run it whenever you need to:
IF EXIST .\win32build\ GOTO STARTUPDATE
mkdir win32build
:STARTUPDATE
cd .\win32build
cmake .. -G"Visual Studio 16 2019" -Tv142 -A Win32
@REM cmake .. -G"Visual Studio 15 2017" -Tv141
Otherwise you can right-click on the “ZERO_CHECK” project when you have your solution loaded in Visual Studio, and build that specific project. It should also work.