1

我正在用 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"

我想知道为什么我会收到此错误以及谁来解决它。

4

0 回答 0