简体   繁体   English

Visual Studio 2022 C++ Qt 项目中的错误

[英]Error in Visual Studio 2022 C++ Qt project

I am working on a C++ project on Visual Studio 2022 with Qt and OpenCV.我正在使用 Qt 和 OpenCV 在 Visual Studio 2022 上开发 C++ 项目。 I am using VideoCapture to open an rtsp stream using the open() function.我正在使用 VideoCapture 使用 open() 函数打开一个 rtsp 流。

However, I get an exception as follows when I try to open the rtsp stream:但是,当我尝试打开 rtsp 流时,出现如下异常:

Exception thrown at 0x00007FFB37BB4F69 in faulty.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000029218FF9F0.
The thread 0x45d8 has exited with code 0 (0x0).

The relevant code is as follows:相关代码如下:

string un = port_ipDialog->devInfo.szUserName;
string stri = "rtsp://" + un + ":" + PWD + "@" + IP + "/gen/fakescreen?channel=5&subtype=2";
memcpy(rtsp, stri.c_str(), 256);
if (!capture.open(rtsp)) {
    QMessageBox::warning(nullptr, "notice", "fail!!", QMessageBox::Yes | QMessageBox::Yes);
    return;
}

The strange thing is that the same thing is working perfectly on another computer.奇怪的是,同样的事情在另一台计算机上也能完美运行。

Can someone give some insight into this exception and why it might be occurring?有人可以对此异常以及为什么会发生这种情况提供一些见解吗? I would be grateful.我将感激不尽。

well thi9s line invokes UB好吧,这行调用了 UB

 memcpy(rtsp, stri.c_str(), 256);

the input is shorter that 256, also what is the size of rtsp?输入比256短,rtsp的大小是多少?

Why not use strcpy为什么不使用strcpy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C ++在Qt项目中包括Visual Studio头文件。 <xstring> 包含错误 - C++ Including Visual Studio header files in Qt project. <xstring> include error 如何将Qt与visual studio c ++应用程序项目联系起来? - how to link Qt with a visual studio c++ application project? 将Qt添加到现有的Visual Studio 2013 C ++项目 - Add Qt to an existing Visual Studio 2013 C++ project 如何在 Windows 11 PC 上将 fltk 图形库与 Visual Studio(社区)2022 一起用于 C++ 项目 - How to use fltk graphic library with visual studio (community) 2022 for C++ project on Windows 11 PC Visual Studio 2022 如何将 android 支持添加到我的 C++ 项目 - Visual Studio 2022 How to add android support to my C++ project 在 VIsual Studio 2022 Community 中构建 C++ 解决方案将 JSON 架构文件夹添加到项目 - Building C++ solution in VIsual Studio 2022 Community adds a JSON schema folder to project C++ 由于 Visual Studio 2022 中缺少 lnk{...}.tmp 文件,项目被重建 - C++ project gets rebuilt due to missing lnk{...}.tmp file in Visual Studio 2022 使用 Visual Studio 2022 格式化 C/C++ 代码 - Formatting C/C++ code with Visual Studio 2022 Header 在 Visual Studio 2022 中将 C++ 用于 Linux 时出现包含错误 - Header inclusion error when using C++ for Linux in Visual Studio 2022 C++ 中的单元测试问题 (Visual Studio 2022) - Problems with Unit Testing in C++ (Visual studio 2022)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM