我正在用Visual C ++编写代码来访问计算机的串口。
代码如下: -
#include<windows.h>
#include<stdio.h>
#include<cstring>
#include<string.h>
#include<conio.h>
#include<iostream>
using namespace std;
//#include "stdafx.h"
#ifndef __CAPSTONE_CROSS_SERIAL_PORT__
#define __CAPSTONE_CROSS_SERIAL_PORT__
HANDLE hSerial= CreateFile("COM1", GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
在上面的代码中,我在上面代码的最后一行“”COM1“中收到错误。
错误如下: -
Error: argument of type "cons char *" is incompatible with parameters of type "LPCWSTR"
我想知道为什么我会收到此错误以及解决问题的人。