Compilation errors in qt header files vs 2010 - visual-studio-2010

I am trying to test my qt project with cppunit. The tests project uses MFC.
I am using Visual studio 2010.
I have included the qt libraries , dlls and made other changes in the project settings like adding preprocessor definitions to compile the cpp file which I want to test. But when I compile this cpp file, I get a lot of syntax errors, located in qt header files..The compilation output is given below:
1>------ Build started: Project: my_tests, Configuration: Debug Win32 ------
1>cl : Command line warning D9025: overriding '/ZI' with '/Zi'
1>cl : Command line warning D9025: overriding '/GS' with '/GS-'
1>cl : Command line warning D9025: overriding '/Zc:wchar_t' with '/Zc:wchar_t-'
1> CSetting.cpp
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qiodevice.h(247): error C2143: syntax error : missing ')' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qiodevice.h(247): error C2143: syntax error : missing ';' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qiodevice.h(247): error C2805: binary 'operator <<' has too few parameters
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qiodevice.h(247): error C2059: syntax error : ')'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2143: syntax error : missing ')' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2143: syntax error : missing ';' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2805: binary 'operator <<' has too few parameters
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2988: unrecognizable template declaration/definition
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2059: syntax error : 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2065: 'T' : undeclared identifier
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(160): error C2059: syntax error : ')'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(178): error C2065: 'T' : undeclared identifier
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(180): error C2143: syntax error : missing ';' before '{'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(180): error C2447: '{' : missing function header (old-style formal list?)
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(190): error C2143: syntax error : missing ')' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(190): error C2143: syntax error : missing ';' before 'constant'
1>c:\qt\4.8.2\include\qtcore\../../src/corelib/io/qdebug.h(190): fatal error C1903: unable to recover from previous error(s); stopping compilation
Please help me with these errors..

You must be using QT 4.8.x or older.
All version before QT 5.x are compiled with
/Zc:wchar_t-
(it means: DO NOT treat WChar_t as built in type) which is not compatible with MFC, BOOST or CUDA libraries.
You need to switch to QT 5.x in which the flag changed to
/Zc:wchar_t
(without "minus" on the end) - it is compiled this way (they considered this as a flaw).
Or compile older version with /Zc:wchar_t, by changing it in source file:
QTSRC\mkspecs\win32-msvc2010\qmake.conf

I can only guess, but you sometimes get these kind of errors if you are missing the final semicolon after a class definition, or a closing bracket at any point.
class XXX
{
}; // <- this one could be missing
in your CSettings.cpp, check which file you include directly before QIODevice or QDebug. This is usually the faulty class (could be CSettings.h)

Related

How do I compile a TensorFlow Lite GPU delegate for Windows

I have a TensorFlow Lite C API library that I am using on Windows and I want it to use a GPU delegate. I do not have any trouble compiling the TensorFlow Lite C API library with bazel on my Windows machine, but I cannot get the GPU delegate to compile.
TensorFlow version: 2.10.0
Windows version: 10.0.19044
Even though TFLite does not support the Windows platform there is a clear indication that it should be possible to compile a GPU delegate for the Windows platform using ANGLE library (see https://github.com/tensorflow/tensorflow/issues/28830#issuecomment-522325199).
It feels like I am close to the solution but I must be missing something fundamental. I am quite new to most of the tools and concepts involved, but I managed to stitch together the following procedure:
Installed ANGLE according to https://chromium.googlesource.com/angle/angle/+/main/doc/DevSetup.md (COMMIT=596c2acfa5071eb643eaffe855a5ccb51c345427)
Built ANGLE libraries with following args (args.gn):
is_component_build = false
target_cpu = "x64"
is_debug = false
angle_assert_always_on = false
Added ANGLE build output directory (containing libEGL.dll, libEGL.dll.lib, libGLESv2.dll, libGLESv2.dll.lib, d3dcompiler_47.dll) to PATH environment variable.
Added ANGLE library dependency in bazel:
In WORKSPACE file:
new_local_repository(
name = "angle",
path = "../../../angle/angle/include",
build_file_content = """
package(default_visibility = ["//visibility:public"])
cc_library(
name = "headers",
srcs = glob(["**/*.h"])
)
"""
)
Added necessary dependencies (copts = ["-Iexternal/angle"] and "#angle//:headers") to targets in bazel BUILD files (all targets that failed compilation due to missing OpenGL headers):
Example:
cc_library(
name = "gl_errors",
srcs = ["gl_errors.cc"],
hdrs = ["gl_errors.h"],
copts = ["-Iexternal/angle"], <--- ADDED THIS
deps = [
"#angle//:headers", <--- ADDED THIS
":portable",
"//tensorflow/lite/delegates/gpu/common:status",
"#com_google_absl//absl/strings",
],
)
Updated .bazel to use '/std:c++latest'
---build:windows --cxxopt=/std:c++17
---build:windows --host_cxxopt=/std:c++17
+++build:windows --cxxopt=/std:c++latest
+++build:windows --host_cxxopt=/std:c++latest
Build TensorFlow Lite GPU delegate (v2.10.0) //tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so
bazel2 build --local_cpu_resources=3 --features=windows_export_all_symbols -s -c opt --copt="-DMESA_EGL_NO_X11_HEADERS" --copt="-DEGL_NO_X11" //tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so
I expected to get the two files libtensorflowlite_gpu_delegate.so.dll and libtensorflowlite_gpu_delegate.so.if.lib but I get errors that I do not know how to mitigate.
ERROR: C:/users/magnusg/src/tensorflow_lite/tflite_2.10.0_gpu_delegate_build_bazel/tensorflow_src/tensorflow/lite/delegates/gpu/cl/kernels/BUILD:129:11: Compiling tensorflow/lite/delegates/gpu/cl/kernels/converter.cc failed: (Exit 2): cl.exe failed: error executing command
cd /d C:/users/magnusg/_bazel_magnusg/4du655w4/execroot/org_tensorflow
SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\cppwinrt
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\devinit;C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\\MSBuild\Current\Bin;c:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\;;C:\Windows\system32;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
SET PWD=/proc/self/cwd
SET PYTHON_BIN_PATH=C:/Users/magnusg/anaconda3/envs/sa/python.exe
SET PYTHON_LIB_PATH=C:/Users/magnusg/anaconda3/envs/sa/lib/site-packages
SET RUNFILES_MANIFEST_ONLY=1
SET TEMP=C:\Users\magnusg\AppData\Local\Temp
SET TF2_BEHAVIOR=1
SET TMP=C:\Users\magnusg\AppData\Local\Temp
SET avariable=3
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe #bazel-out/x64_windows-opt/bin/tensorflow/lite/delegates/gpu/cl/kernels/_objs/converter/converter.obj.params
# Configuration: 4692499b740a707abb55d09dbd7c915fbefe7b433a9f783356c086c94c980334
# Execution platform: #local_execution_config_platform//:platform
cl : Command line warning D9035 : option 'experimental:preprocessor' has been deprecated and will be removed in a future release
cl : Command line warning D9036 : use 'Zc:preprocessor' instead of 'experimental:preprocessor'
cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(526): error C2059: syntax error: '__cdecl'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(532): error C2065: 'cl_command_buffer_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(532): error C2165: 'left-side modifier': cannot modify pointers to data
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(532): error C2513: 'cl_int *': no variable declared before '='
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(535): error C2065: 'cl_command_buffer_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(535): error C2165: 'left-side modifier': cannot modify pointers to data
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(535): error C2513: 'cl_int *': no variable declared before '='
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(538): error C2065: 'cl_command_buffer_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(538): error C2165: 'left-side modifier': cannot modify pointers to data
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(538): error C2513: 'cl_int *': no variable declared before '='
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(542): error C2061: syntax error: identifier 'cl_command_buffer_khr'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(547): error C2065: 'cl_command_buffer_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(548): error C2275: 'cl_command_queue': illegal use of this type as an expression
external/angle\CL/cl.h(32): note: see declaration of 'cl_command_queue'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(549): error C2059: syntax error: 'const'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(559): error C2065: 'cl_command_buffer_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(560): error C2065: 'cl_command_buffer_info_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(560): error C2275: 'size_t': illegal use of this type as an expression
tensorflow/lite/delegates/gpu/cl/kernels/converter.cc: note: see declaration of 'size_t'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(561): error C2062: type 'void' unexpected
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(682): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(682): error C2146: syntax error: missing ';' before identifier 'clCreateCommandBufferKHR'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(687): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(687): error C2146: syntax error: missing ';' before identifier 'clCommandNDRangeKernelKHR'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(688): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(688): error C2146: syntax error: missing ';' before identifier 'clGetCommandBufferInfoKHR'
Target //tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so failed to build
INFO: Elapsed time: 375.856s, Critical Path: 62.04s
INFO: 686 processes: 15 internal, 671 local.
FAILED: Build did NOT complete successfully
I do not know if I am on the right track and simply missing a minor detail or if I am missing the target completely. Any feedback would be helpful.

Fatal error (1017) invalid integer constant expression in ctype.h during migration from VS6 to VS5

While migrating VC++ code from VS6 (1998) to VS5(later year) I had to remove __STDC__ from project properties->Preprocessors. It fix lot of 'tagVariant' related errors.
Next what happened is function definitions were not recognized in many of the project file.
so I added #define __STDC__ in problem files which also took care of many unrecognized function definition related errors.
Now the project is left with only one error in compiling one file which says
"Fetal error (1017) invalid integer constant expression in ctype.h" and the code its pointing to line number 362 in ctype.h #define !__STDC__ etc
Any ideas - suggestions ?
I tried to - Remove any #define __STDC__ that you added locally. Also remove __STDC__ from Preprocessor definitions if you haven't done so already.
Select all the .c files in the solution explorer and select properties in the solution explorer context menu. In the properties dialog select /Za for C/C++\Language\Disable Language Extensions property.
Which took me back to ->
error C2065: ‘xyz’: undeclared identifier
: error C2182: ‘pqr’ : illegal use of type 'void'
: error C2065: ‘some variable’ : undeclared identifier
: error C2146: syntax error : missing ';' before identifier ‘classname’
: error C2143: syntax error : missing ';' before '*'
: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
: error C2040: ‘variable2’ : 'int *' differs in levels of indirection from ''unknown-type''
.
.
.
all the errors are in my files.
Reference :
http://social.msdn.microsoft.com/Forums/en-US/e68b0af5-ed25-4953-80e7-e88463149b77/fatal-error-1017-invalid-integer-constant-expression-in-ctypeh-during-migration-from-vs6-to-vs5?forum=vcgeneral
Wow...I could compile the project. Big Grin | :-D I do have lot of LINK errors but I will work on it.
I learnt this "Use precompiled headers ("#include "). This must be the first include in your .cpp file."
Changed the sequence of the .h files and I am all set now.

Visual Studio 2010 C++ Release Mode Issue

I am trying to compile my c++ project in visual studio 2010, that has been running fine in debug mode for the past several months. I am finished developing it, so I would like to create an exe to release.
The issue is that I am receiving a bunch of compiler errors when I switch it to release mode that I am not sure how to debug.
Any help would be appreciated:
1>main.obj : error LNK2005: "int __cdecl initKinect(void)" (?initKinect##YAHXZ) already defined in gui.obj
1>main.obj : error LNK2005: _main already defined in gui.obj
1>Kinect.lib(Kinect-win32.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in algorithm.obj
1>Kinect.lib(Kinect-win32.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
1>Kinect.lib(Kinect-Driver.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in algorithm.obj
1>Kinect.lib(Kinect-FrameInput.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in algorithm.obj
1>libcpmtd.lib(stdthrow.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in algorithm.obj
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)
1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype_l already defined in LIBCMT.lib(isctype.obj)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>C:\Users\Tom\Documents\Kinect\repository\KinectTracker\Release\KinectTracker.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
This looks to me like you are linking two sets of libraries (besides possible other problems). Libcmtd is multithreaded-debug version of libc, and libcmt is release version of same thing.

Building Perl/C module using Microsoft VC (cl.exe) 2010 (10.0) Express and ActivePerl 5.12.4/32

I'm facing this build problem using the configuration mentioned in the title. The Perl module I'm trying to build is MongoDB::Connection. I'm building via the CPAN shell, or manually like this:
C:\Opt\Perl512.32\bin\perl.exe Makefile.PL
nmake
The command line for cl.exe is:
cl -c -I. -MD -Zi -DNDEBUG -DVERSION=\"0.43\" -DXS_VERSION=\"0.43\" ^
/Foxs/BSON.obj "-IC:\Opt\Perl512.32\lib\CORE" xs\BSON.c
Here are the error codes and their frequencies:
6 C2040 'operator' : 'identifier1' differs in levels of indirection
from 'identifier2'
32 C2059 syntax error : 'token'
7 C2081 'identifier' : name in formal parameter list illegal
54 C2143 syntax error : missing 'token1' before 'token2'
2 C2371 'identifier' : redefinition; different basic types
It looks to me like all these errors are symptoms of a failure in the preprocessing stage.
I won't paste the entire output here, but the beginning is:
c:\opt\perl512.32\lib\core\win32.h(368) : error C2143: Syntaxfehler: Es fehlt ')' vor '*'
c:\opt\perl512.32\lib\core\win32.h(368) : error C2081: 'Stat_t': Name in der formalen Parameterliste ist ungültig
c:\opt\perl512.32\lib\core\win32.h(368) : error C2143: Syntaxfehler: Es fehlt '{' vor '*'
c:\opt\perl512.32\lib\core\win32.h(368) : error C2059: Syntaxfehler: ')'
c:\opt\perl512.32\lib\core\win32.h(369) : error C2143: Syntaxfehler: Es fehlt ')' vor '*'
c:\opt\perl512.32\lib\core\win32.h(369) : error C2081: 'STRLEN': Name in der formalen Parameterliste ist ungültig
So given the clue Stat_t, I tried to track down the issue.
ack Stat_t c:\opt\perl512.32\lib\core\
So Stat_t is defined in CORE\dosish.h and CORE\unixish.h. Both are conditionally included from CORE\perl.h. Which is included from the file I'm trying to compile. So it should work.
What can I do to track the issue down?
What's causing this failure?
There are some similar errors floating about the net. Here a Google search for you:
http://www.google.com?q=perl+win32.h+c2059+c2143+c2081+c2371
Thanks.
This looks like a bug report.
Maybe it's worth sending to CPAN bug tracker? https://rt.cpan.org/Public/Dist/Display.html?Name=MongoDB

visual c++ create text file

How to create text file?
CreateFile("1",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
CREATE_NEW,
FILE_FLAG_OVERLAPPED,
NULL);
throw
1>------ Build started: Project: test2, Configuration: Debug Win32 ------
1> test2.cpp
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(126): error C2065: 'GENERIC_READ' : undeclared identifier
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(126): error C2065: 'GENERIC_WRITE' : undeclared identifier
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(128): error C2065: 'NULL' : undeclared identifier
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(129): error C2065: 'CREATE_NEW' : undeclared identifier
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(130): error C2065: 'FILE_FLAG_OVERLAPPED' : undeclared identifier
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(131): error C2065: 'NULL' : undeclared identifier
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(125): error C3861: 'CreateFile': identifier not found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Include the Windows header file as follows at the top of your .h or .cpp files:
#include <windows.h>
This should solve the problems related to undefined symbols such as GENERIC_WRITE and CreateFile. As another poster mentioned, you should typically write your code in .cpp files and only declare constants or classes in header files while placing the method implementations in .cpp files along with regular functions.
The issues related to CreateFileW once you get beyond this point need some more explanation:
By default, Windows applications generated from Visual Studio templates link against Unicode (wide character) versions of Windows APIs and have the UNICODE C/C++ preprocessor macro defined to indicate this. When UNICODE is defined, the preprocessor defines the symbol CreateFile to expand to the name of the actual underlying Windows function name which is CreateFileW where the W suffix indicates it is a "wide-character", i.e. Unicode, function. If the UNICODE macro is not defined (which can be overridden through various Visual Studio project settings), then CreateFile will expand to the CreateFileA symbol which is the name of the ANSI string version (A for ANSI) of the function. 99% of the time you should use the default settings for UNICODE as all modern versions of windows use Unicode characters internally.
Since CreateFileW takes Unicode string arguments you need to pass L"1" (i.e. a wide-character string literal) or use the TEXT macro (e.g. TEXT("1")) which will generate the correct string type corresponding to whether the UNICODE compiler switch is defined or not.
Here's a link to the MSDN article about TEXT: link.

Resources