C++ cli 正在尝试将SerialPort输入打印到控制台

C++ cli 正在尝试将SerialPort输入打印到控制台,c++-cli,visual-studio-2019,C++ Cli,Visual Studio 2019,首先,我的代码: #include <iostream> #include <thread> #using <System.dll> using namespace System; using namespace System::IO::Ports; using namespace System::Threading; int main() { SerialPort^ mySerialPort = gcnew SerialPort("CO

首先,我的代码:

#include <iostream>
#include <thread>
#using <System.dll>

using namespace System;
using namespace System::IO::Ports;
using namespace System::Threading;

int main()
{
    SerialPort^ mySerialPort = gcnew SerialPort("COM5");
    mySerialPort->BaudRate = 9600;
    mySerialPort->Parity = Parity::None;
    mySerialPort->StopBits = StopBits::One;
    mySerialPort->DataBits = 8;
    mySerialPort->Handshake = Handshake::None;
    mySerialPort->RtsEnable = true;

    while (1)
    {
        Console::WriteLine(Console::ReadLine());
    }
}
#包括
#包括
#使用
使用名称空间系统;
使用名称空间System::IO::Ports;
使用名称空间系统::线程;
int main()
{
SerialPort ^mySerialPort=gcnew SerialPort(“COM5”);
mySerialPort->波特率=9600;
mySerialPort->奇偶校验=奇偶校验::无;
mySerialPort->StopBits=StopBits::One;
mySerialPort->DataBits=8;
mySerialPort->Handshake=握手::无;
mySerialPort->RtsEnable=true;
而(1)
{
Console::WriteLine(Console::ReadLine());
}
}
其想法是从串行端口读取数据并写入控制台

最初我打算使用:

std::cout << Console::ReadLine() << '\n';

std::cout根据“元素的无效值为”Yes(/permissive-)/Zc:twoPhase-”判断,您已将此编译器选项放在它不属于的位置。确保你知道它应该去哪里。例如,

没有解决方案。我遇到“无法打开文件'MSCOREE.lib'”错误。看来这个文件在Windows中已经不存在了,我不知道如何找到它。所以我使用了VisualStudio


编辑:eXCore关于.NET框架的评论解决了这个问题。

我试过了。我解决了一个错误,给了我一个新的。无法打开文件“MSCOREE.lib”。@saltyrusnpoto我查找了它,它看起来像是.NET Framework SDK的问题。