1.退回上一笔的改动

2.添加try catch块
3.设置生成pdb文件并且关闭优化
CigaretteSH
Jinhuan 2 months ago
parent 318000820f
commit bec1a3e4d0

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
@ -215,7 +215,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp14</LanguageStandard> <LanguageStandard>stdcpp14</LanguageStandard>
<Optimization>MaxSpeed</Optimization> <Optimization>Disabled</Optimization>
<SupportJustMyCode>false</SupportJustMyCode> <SupportJustMyCode>false</SupportJustMyCode>
<DisableSpecificWarnings>4819;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4819;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
@ -223,7 +223,7 @@
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile> <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(ProjectDir)OpenCV455Simple\win64\vc15\lib;$(ProjectDir)Pylon6.2\lib\Win64;$(ProjectDir)MvIMPACT\lib\win64;$(ProjectDir)MVS3.2.1\lib\win64;$(ProjectDir)modbus;Ws2_32.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(ProjectDir)OpenCV455Simple\win64\vc15\lib;$(ProjectDir)Pylon6.2\lib\Win64;$(ProjectDir)MvIMPACT\lib\win64;$(ProjectDir)MVS3.2.1\lib\win64;$(ProjectDir)modbus;Ws2_32.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>opencv_world455.lib;modbus.lib;mvDeviceManager.lib;MvCameraControl.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>opencv_world455.lib;modbus.lib;mvDeviceManager.lib;MvCameraControl.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>
</IgnoreSpecificDefaultLibraries> </IgnoreSpecificDefaultLibraries>

@ -310,6 +310,7 @@ int ExportDataThread::insertXMLNode(const char* xmlPath, _XMLExportDataInfo& dat
void ExportDataThread::run() void ExportDataThread::run()
{ {
try {
while (!b_quit || (b_quit && (!export_XMLData_Info_queue->isEmpty() || readyToSendZip || !tmpListToZip.isEmpty()))) { while (!b_quit || (b_quit && (!export_XMLData_Info_queue->isEmpty() || readyToSendZip || !tmpListToZip.isEmpty()))) {
_XMLExportDataInfo element; _XMLExportDataInfo element;
if (!export_XMLData_Info_queue->isEmpty()) { if (!export_XMLData_Info_queue->isEmpty()) {
@ -359,14 +360,17 @@ void ExportDataThread::run()
QFile* file[2] = { NULL }; QFile* file[2] = { NULL };
QFile fileNg(fileList[0]); file[0] = new QFile(fileList[0]);
QFile fileOk(fileList[1]); file[1] = new QFile(fileList[1]);
fileNg.open(QIODevice::WriteOnly); // QFile fileNg(fileList[0]);
fileOk.open(QIODevice::WriteOnly); // QFile fileOk(fileList[1]);
QTextStream ngStream(fileNg); file[0]->open(QIODevice::WriteOnly);
QTextStream okStream(fileOk); file[1]->open(QIODevice::WriteOnly);
QTextStream ngStream(file[0]);
QTextStream okStream(file[1]);
argsNg.append("a"); argsNg.append("a");
argsNg.append(zipFilePaths[0]); argsNg.append(zipFilePaths[0]);
@ -391,8 +395,8 @@ void ExportDataThread::run()
argsOk.append("-i@" + fileList[1]); argsOk.append("-i@" + fileList[1]);
argsOk.append("-mx=3"); argsOk.append("-mx=3");
fileNg.close(); file[0]->close();
fileOk.close(); file[1]->close();
for (int i = 0; i < zipFilePaths.size(); i++) { for (int i = 0; i < zipFilePaths.size(); i++) {
if (file[i]->size() == 0) { if (file[i]->size() == 0) {
@ -409,8 +413,8 @@ void ExportDataThread::run()
QFile file(zipFilePaths[i]); QFile file(zipFilePaths[i]);
file.remove(); file.remove();
} }
fileNg.remove(); file[0]->remove();
fileOk.remove(); file[1]->remove();
listToZip.clear(); listToZip.clear();
readyToSendZip = false; readyToSendZip = false;
} }
@ -429,6 +433,16 @@ void ExportDataThread::run()
InternetCloseHandle(hint); InternetCloseHandle(hint);
hint = NULL; hint = NULL;
} }
}
catch (const std::exception& e) {
// 注意std::exception通常不捕获由运行时错误引发的异常
// 但这里是为了演示catch块的结构
std::cerr << __FUNCTION__<<"捕获到异常: " << e.what() << std::endl;
}
catch (...) {
// 使用省略号(...)可以捕获所有类型的异常,这是一种通用的捕获方式
std::cerr << "捕获到未知类型的异常" << std::endl;
}
} }
//*****************************************已经调试好,没有理清逻辑前不要动********************** //*****************************************已经调试好,没有理清逻辑前不要动**********************

@ -389,9 +389,13 @@ void SyncWorkThread::run()
// emit display_check_total(local_camera_number, ++(frame_total[local_camera_number])); // emit display_check_total(local_camera_number, ++(frame_total[local_camera_number]));
} }
} }
catch (cv::Exception& e) catch (const std::exception& e) {
{ // 注意std::exception通常不捕获由运行时错误引发的异常
const char* err_msg = e.what(); // 但这里是为了演示catch块的结构
std::cout << "exception caught: " << err_msg << std::endl; std::cerr << __FUNCTION__<<"捕获到异常: " << e.what() << std::endl;
}
catch (...) {
// 使用省略号(...)可以捕获所有类型的异常,这是一种通用的捕获方式
std::cerr << "捕获到未知类型的异常" << std::endl;
} }
} }

@ -25,6 +25,7 @@ void threadSend::stop()
void threadSend::run() void threadSend::run()
{ {
try {
while (isLoop) while (isLoop)
{ {
_UDPSendInfo UDPSendInfo; _UDPSendInfo UDPSendInfo;
@ -60,6 +61,16 @@ void threadSend::run()
} }
} }
} }
}
catch (const std::exception& e) {
// 注意std::exception通常不捕获由运行时错误引发的异常
// 但这里是为了演示catch块的结构
std::cerr << __FUNCTION__<<"捕获到异常: " << e.what() << std::endl;
}
catch (...) {
// 使用省略号(...)可以捕获所有类型的异常,这是一种通用的捕获方式
std::cerr << "捕获到未知类型的异常" << std::endl;
}
} }
void threadSend::sendData(_UDPSendInfo* UDPSendInfo, int port) void threadSend::sendData(_UDPSendInfo* UDPSendInfo, int port)

@ -64,7 +64,7 @@ bool threadSendTCP::connectTCP() {
void threadSendTCP::run() void threadSendTCP::run()
{ {
try {
#ifdef __TCPClient #ifdef __TCPClient
if (!connectTCP()) if (!connectTCP())
{ {
@ -87,7 +87,16 @@ void threadSendTCP::run()
#endif #endif
//mySocket->write("Hello! here is tcp client!\n"); //mySocket->write("Hello! here is tcp client!\n");
//mySocket->flush(); //mySocket->flush();
}
}
catch (const std::exception& e) {
// 注意std::exception通常不捕获由运行时错误引发的异常
// 但这里是为了演示catch块的结构
std::cerr << __FUNCTION__<<"捕获到异常: " << e.what() << std::endl;
}
catch (...) {
// 使用省略号(...)可以捕获所有类型的异常,这是一种通用的捕获方式
std::cerr << "捕获到未知类型的异常" << std::endl;
} }
} }

@ -321,9 +321,13 @@ void WorkThread::run()
#endif #endif
} }
} }
catch (cv::Exception& e) catch (const std::exception& e) {
{ // 注意std::exception通常不捕获由运行时错误引发的异常
const char* err_msg = e.what(); // 但这里是为了演示catch块的结构
std::cout << "exception caught: " << err_msg << std::endl; std::cerr << __FUNCTION__<<"捕获到异常: " << e.what() << std::endl;
}
catch (...) {
// 使用省略号(...)可以捕获所有类型的异常,这是一种通用的捕获方式
std::cerr << "捕获到未知类型的异常" << std::endl;
} }
} }

Loading…
Cancel
Save