编译错误汇总

2 篇文章 0 订阅

1 、边界超限

OpenCV Error: Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)size.p[0] && (unsigned)(i1*DataType<_Tp>::channels) < (unsigned)(size.p[1]*channels()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1 << 3) - 1))*4) & 15) == elemSize1()) in cv::Mat::at, file c:\projects\circledectec\circledectec\opencv\build\include\opencv2\core\mat.hpp, line 537

  • 数据类型问题,初始化矩阵的数据类型为CV_64FC1(double)时,以at()访问时应为double型

2 、 error C4996: ‘std::_Copy_impl’:

  • c++预处理器添加_SCL_SECURE_NO_WARNINGS

3 、 exe与platforms放在统一文件路径下,界面的图片全部消失

  • 从QT主目录下plugins文件夹中的imageformats文件夹拷贝到exe所在目录中即可,imageformats文件夹包含了许多图片格式的插件

4 、Qt 界面最小化后再次打开,导致所有控件不刷新,但是能够接收鼠标事件

  • -解决办法:
void CBCTUI::showEvent(QShowEvent *e)
{
	// Necessary! If not do this, when you minimize the window
	// and restore, the button will ignore the hover event.
	repaint();    
    this->setAttribute(Qt::WA_Mapped);
    QWidget::showEvent(e);
}

5 、在使用qvtkwidget显示图像时时无法编译通过

  • -解决办法:在使用QVTKWidget.h时添加以下命令
#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)  
#define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)  
#include "QVTKWidget.h"
#include <vtkAutoInit.h>    
VTK_MODULE_INIT(vtkRenderingOpenGL);
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingFreeType);

6 、Qt 《warning MSB8027》解决方案

warning MSB8027: Two or more files with the name of moc_Geometry.cpp will produce outputs to the same location. This can lead to an incorrect build result. The files involved are GeneratedFiles\Debug\moc_XXX.cpp, GeneratedFiles\Release\moc_XXX.cpp.

  • 由于Qt插件的MocDirectory设置冲突导致
    在这里插入图片描述

7 、vtkOpenGLRenderer (000000000DEA0160): Resetting view-up since view plane normal is parallel

在这里插入图片描述

  • 12. 三视图颠倒,并且无法正常显示,由方向不同导致
if (i == 0)
        {
            riw[i]->SetInputData(flip->GetOutput());
            riw[i]->SetSliceOrientationToXY();//Transverse/Axisplane
            rep->GetResliceCursorActor()->GetCursorAlgorithm()->SetReslicePlaneNormal(2);
            riw[i]->SetResliceModeToAxisAligned();
            riw[i]->SetSlice(riw[i]->GetSliceMax() / 2 + 0.5);
        }
        else if (i == 1)
        {
            riw[i]->SetInputData(vtkReader->GetOutput());
            riw[i]->SetSliceOrientationToYZ(); //Sagittal plane
            rep->GetResliceCursorActor()->GetCursorAlgorithm()->SetReslicePlaneNormal(0);
            riw[i]->SetResliceModeToAxisAligned();
            riw[i]->SetSlice(riw[i]->GetSliceMax() / 2 + 0.5);
        }
        else
        {
            riw[i]->SetInputData(vtkReader->GetOutput());
            riw[i]->SetSliceOrientationToXZ();//Coronal/Frontal plane
            rep->GetResliceCursorActor()->GetCursorAlgorithm()->SetReslicePlaneNormal(1);
            riw[i]->SetResliceModeToAxisAligned();
            riw[i]->SetSlice(riw[i]->GetSliceMax() / 2 + 0.5);
        }

8 、出现字符结尾识别不清问题,由于特殊文件加锁导致

在这里插入图片描述

9 、库文件包含问题

itkgdcmCommon-4.8.lib(gdcmSystem.obj) : error LNK2001: 无法解析的外部符号 gethostname
1>itkgdcmCommon-4.8.lib(gdcmSystem.obj) : error LNK2001: 无法解析的外部符号 WSAStartup
1>itkgdcmCommon-4.8.lib(gdcmSystem.obj) : error LNK2001: 无法解析的外部符号 WSACleanup
1>E:\projects\RTKReconstructionGPUVolume\x64\Release\RTKReconstruction.exe : fatal error LNK1120: 4 个无法解析的外部命令

  • 解决办法:
#include <winsock2.h> 
#pragma comment(lib, "WS2_32")

1>itkgdcmMSFF-4.8.lib(gdcmUIDGenerator.obj) : error LNK2001: 无法解析的外部符号 __imp_UuidCreate

  • 解决办法: 添加rpcrt4.lib

10 、vtk render问题

vtkOpenGLTexture :failure after ReleaseGraphicResources 16 OpenGL errors detected
在这里插入图片描述

  • 解决办法: 注释代码段中的Render()

11 、调用dcmtk出现问题

错误 1 error LNK2019: 无法解析的外部符号 “struct OFConditionConst const EC_Normal” (?EC_Normal@@3UOFConditionConst@@B),该符号在函数 “public: bool __cdecl CTHeaderInformation::SetParameter(class DcmFileFormat &)” (?SetParameter@CTHeaderInformation@@QEAA_NAEAVDcmFileFormat@@@Z) 中被引用。

  • 解决办法: “ofstd.lib”库文件已经添加还是报错,由于.h和.cpp文件放在工程文件的指定文件夹下,将该路径添加到附近包含目录即可。另外为解决unicode编译,注释“tchar.h”中的UNICODE部分。

12、调用重建接口报错

在这里插入图片描述

  • 解决办法: 出现问题的原因是 调用了多个库文件,在引用时添加头文件的顺序问题,重新排列顺序解决

13、编译debug版本(利用VTK)报错

QWidget: Must construct a QApplication before a QWidget

  • 解决办法: Release 和Debug 动态库引用发生混乱导致

14、VTK显示3D图像突然无法正常显示

在这里插入图片描述
左侧显示区域内容是黑的,右侧是正常显示,这是突然发生的现象,在其他电脑上也是正常的。

  • 解决办法: 把显示适配器中的NVIDIA启用
    Release 和Debug 动态库引用发生混乱导致

15、VTK显示3D图像时弹出警告框

在这里插入图片描述

Generic Warning: In D:\VTK-7.1.1\Rendering\Volume\vtkVolumeTextureMapper3D.cxx, line 682
vtkVolumeTextureMapper3D::vtkVolumeTextureMapper3D was deprecated for VTK 7.0 and will be removed in a future version.

Generic Warning: In D:\VTK-7.1.1\Rendering\VolumeOpenGL\vtkOpenGLVolumeTextureMapper3D.cxx, line 57
vtkOpenGLVolumeTextureMapper3D::vtkOpenGLVolumeTextureMapper3D was deprecated for VTK 7.0 and will be removed in a future version.
  • 解决办法: 待解决

备注:博客中有些问题解决办法取自其他博客,未注明具体出处。

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

三人行-Team

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值