Compilation error on Windows 10
dumganhar opened this issue · comments
FindFirstFile
function is missing on Windows 10.
Hi @dumganhar , can you please try compiling one of the examples, to see if any one fails. If so, could you please provide:
- the full error log
- your version of Windows
- your compiler/IDE version
@dumganhar @cxong
Hi when compiling windows 10 Uwp helloworld for cocos2d-x V3.15 i get this error:
1>------ Build started: Project: libcocos2d, Configuration: Debug Win32 ------
1>CCFileUtils.cpp
1>C:\Users\arash\Documents\CocosProjects\AAAAA\cocos2d\external\tinydir/tinydir.h(297): error C3861: 'FindFirstFile': identifier not found
1>Done building project "libcocos2d.vcxproj" -- FAILED.
2>------ Build started: Project: AAAAA, Configuration: Debug Win32 ------
2>LINK : fatal error LNK1181: cannot open input file 'C:\Users\arash\Documents\CocosProjects\AAAAA\proj.win10\Debug\libcocos2d\libcocos2d_v3.15_Windows_10.0.lib'
2>Done building project "AAAAA.vcxproj" -- FAILED.
========== Build: 0 succeeded, 2 failed, 4 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
\cocos2d\external\tinydir/tinydir.h(297): error C3861: 'FindFirstFile': identifier not found
Windows 10 1607
Visual Studio 2017
Not tested for UWP yet.
Looks like UWP uses a completely different API. I imagine adding to tinydir will make it 50% bigger (so that it supports dirent, FindFirstFile, StorageFolder). Also it's an asynchronous API so I'm not sure how it's going to work with tinydir's existing API.
Patches welcome 😄
@dumganhar can you please provide your compiler settings and output? If your patch fixes it then it sounds like a different problem than the one @ArashBaba described. Also I've compiled tinydir under windows 10 and Visual Studio 2017 without problems, so I'm not 100% sure it's purely a windows 10 thing. I can't find a reference online saying that FindFirstFile
is missing on windows 10.
@cxong , in fact, I got the same compile error as @ArashBaba got.
I will check the compile flag tomorrow.
Are you compiling against windows phone 8? The requirements for FindFirstFile
and FindFirstFileEx
are identical except that the latter supports Windows Phone too.
@dumganhar So you replace FindFirstFile with FindFirstFileEx? This will drop the support of Windows 95/98 and something about Windows Phone that @cxong had said.
Sounds like this problem is similar: http://stackoverflow.com/q/32240164/2038264 Unfortunately in that question OP also did not specify their specific compiler settings.
I'm happy to accept this fix but not before understanding what exactly we're fixing; I wasn't aware that tinydir worked under Win 95/98 at all 😄 but I don't think they're important, WinXP+ should be fine. If anyone wants to support Win 95/98 I guess they can submit patches, I don't have access to those so I can't maintain it.
Example 2 just works fine in Windows 95/98(Ansi only) using MINGW now. But it's not important as you said.
I found something that may be to blame.
https://msdn.microsoft.com/en-us/library/windows/apps/mt644399.aspx
FindFirstFile is available in Windows 10.0.14393.0 while FindFirstFileEx in Windows 10.0.10240.0.
Guess this is an issue of Windows SDK version.
14393 is Windows 10 Anniversary Update.
#51 would be a better way to fix this issue. Wait for further tests.