I cloned the official github repo of OpenCV and used CMake to generate the VS Solution.
cmake -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" .
As you can see, I want to build OpenCV for UWP 32-Bit. When building in VS 2015 the opencv_core module fails with:
Error C2664 'BOOL CreateDirectoryA(LPCSTR,LPSECURITY_ATTRIBUTES)': cannot convert argument 1 from 'wchar_t [260]' to 'LPCSTR'
Error C2039 'CreateFileA': is not a member of '`global namespace''
Error C3861 'CreateFileA': identifier not found
Error C2664 'DWORD GetTempPathW(DWORD,LPWSTR)': cannot convert argument 2 from 'char [261]' to 'LPWSTR'
All these error are in the opencv_core in the file "filesystem.cpp. Now, I already successfully build it a few weeks ago, before I had to reformat my pc. Now it just won't build and I don't know how to fix these. Could these problems be related to the Windows 10 SDK?
Looks like you are mixing
UNICODE
and non-UNICODE
builds. Make sure they're consistent and that you use the correct type of strings (use theTEXT()
macro if you like).To verify, right-click the project in VS and choose Properties and then expand C/C++ -> Preprocessor and check the Preprocessor definitions. Click the down-arrow next to the value and click <edit> and then verify the both
UNICODE
and_UNICODE
are defined. If not, add them. You need to repeat this for each configuration (you can try and select "all" but that might mess things up if you have conflicting options).For the last error, change the declaration from
char
towchar_t
to compile.