Cocos2d-x windows編譯 出現GWL_WNDPROC、GWL_USERDATA未定义

錯誤復現:

D:\Software\cocos2d-x\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(64,70): error C2065: 'GWL_WNDPROC': undeclared ide
ntifier [D:\Projects\CPP\CMake\cocos\Runner\fakebuild\engine\cocos\core\cocos2d.vcxproj]
D:\Software\cocos2d-x\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(101,42): error C2065: 'GWL_WNDPROC': undeclared id
entifier [D:\Projects\CPP\CMake\cocos\Runner\fakebuild\engine\cocos\core\cocos2d.vcxproj]
  UIHBox.cpp
D:\Software\cocos2d-x\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(124,17): warning C4312: 'type cast': conversion fr
om 'int' to 'HMENU' of greater size [D:\Projects\CPP\CMake\cocos\Runner\fakebuild\engine\cocos\core\cocos2d.vcxproj
]
D:\Software\cocos2d-x\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(128,42): error C2065: 'GWL_USERDATA': undeclared i
dentifier [D:\Projects\CPP\CMake\cocos\Runner\fakebuild\engine\cocos\core\cocos2d.vcxproj]
D:\Software\cocos2d-x\cocos\ui\UIEditBox\UIEditBoxImpl-win32.cpp(129,66): error C2065: 'GWL_WNDPROC': undeclared id
entifier [D:\Projects\CPP\CMake\cocos\Runner\fakebuild\engine\cocos\core\cocos2d.vcxproj]

編譯過程:

cmake ..
cmake --build . --config Debug

解決方案:
指定生成的平臺win32 以及指定Visual Studio的版本

cmake .. -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Debug -A win32

引用自

cocos2d-x 4.x 项目创建 & 如果报错GWL_WNDPROC的解决方法

貼出clion配置方案:
Cocos2d-x windows編譯 出現GWL_WNDPROC、GWL_USERDATA未定义_第1张图片

你可能感兴趣的:(cocos2d,windows,游戏引擎)