Error1:## d:\vs2017\pcl_DIR\pcl 1.8.1\3rdparty\vtk\include\vtk-8.0\vtkAtomic.h(529): error C2872: “detail”: 不明确的符号
解决办法:打开d:\vs2015\pcl_id\pcl 1.8.1\3rdparty\vtk\include\vtk-8.0\vtkAtomic.h文件在第529行detail之前加上::符号限定命名空间即可。
Error2:## cmake:2350 (message): error: could not find git for clone of __glew
解决办法:在CMake中configure Pangolin时,出现错误error: could not find git for clone of __glew;
原因是没有安装git,可通过以下链接https://git-scm.com/download/win 下载并安装git shell ,重起CMAKE。
Error3:无法打开包括文件: “dirent.h”: No such file or directory
解决办法:下载dirent库:https://github.com/tronkko/dirent,并将dirent库include中的dirent.h直接放到对应工程的目录下,并将#include <dirent.h>改成#include "dirent.h",重新编译。
Error4: error C2065: “M_PI”: 未声明的标识符
解决办法:项目——>”属性"——>配置属性——>C/C++——>预处理器——>预处理器定义,添加如下代码:_USE_MATH_DEFINES
Error5:error LNK2019: 无法解析的外部符号 "public: void __cdecl pcl::EuclideanClusterExtraction<struct pcl::PointNormal>::extract(class std::vector<struct pcl::PointIndices,class std::allocator<struct pcl::PointIndices> > &)" (?extract@?$EuclideanClusterExtraction@UPointNormal@pcl@@@pcl@@QEAAXAEAV?$vector@UPointIndices@pcl@@V?$allocator@UPointIndices@pcl@@@std@@@std@@@Z),该符号在函数 "void __cdecl cleanupMesh(struct pcl::PolygonMesh &,float,int)" (?cleanupMesh@@YAXAEAUPolygonMesh@pcl@@MH@Z) 中被引用
1>E:\WorkSpace\Projects\04_ SurfaceReconstruction\01_Code\myCode\cpu_tsdf\cpu_tsdf\x64\Debug\cpu_tsdf.exe : fatal error LNK1120: 1 个无法解析的外部命令
解决方法:
工程中依次加入以下头文件:
#include <pcl::segmentation/extract_clusters.h>
#include <pcl/segmentation/impl/extract_clusters.hpp>
#include <pcl/search/impl/search.hpp>
重新编译通过,问题解决。
Error6:
1>gui.obj : error LNK2001: 无法解析的外部符号 __imp_glPointSize
1>gui.obj : error LNK2001: 无法解析的外部符号 __imp_glBindTexture
1>gui.obj : error LNK2001: 无法解析的外部符号 __imp_glGenTextures
1>gui.obj : error LNK2001: 无法解析的外部符号 __imp_glEnable
1>gui.obj : error LNK2001: 无法解析的外部符号 __imp_glTexParameteri
1>gui.obj : error LNK2001: 无法解析的外部符号 __imp_glDeleteTextures
解决方法:
1、“项目-属性-库目录”添加路径C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64
2、“项目-属性-链接器-输入”添加OpenGL32.lib
3、特别注意:在“活动(Release)”、“Release”等不同配置中切换时,注意观察的包含、库目录等是否保持一致、是否配置成功,链接器输入的依赖项中的lib文件是否遗漏。
一般无法解析的问题都是没有添加lib库目录或者库导致的
Error7:error C2589: “(”:“::”右边的非法标记
双击error找到报错的位置,把#include <windows.h>提前到该头文件之前包含(可不用),并在报错的文件中加入
#undef max
#undef min
或者:在“属性->c++->预处理器->预处理器定义”中加入NOMINMAX。
Error8:由于找不到glew32.dll,无法继续执行代码。重新安装程序可能会解决此问题
解决办法:尝试将添加glew32.dll添加到C:\Windows\System32或C:\Windows\SysWOW64或者工程项目所生成的可执行文件exe 目录下,一般都能解决问题。
Error9:opencv_core2413.lib(alloc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(main.obj 中)
解决办法:在工程上右键-》属性-》c/c++-》代码生成-》运行库,分别切换如下四个选项并尝试重新生成解决方案:
多线程调试Dll (/MDd) 对应的是MD_DynamicDebug
多线程Dll (/MD) 对应的是MD_DynamicRelease
多线程(/MT) 对应的是MD_StaticRelease
多线程(/MTd)对应的是MD_StaticDebug
Error10:无法启动程序”xxx\build\x64\Release\ALL_BUILD"。 拒绝访问。
可能是vs里一次性加载了多个项目,但是没有设置启动项,只需设置一个有效的项目为启动项即可解决。
Error11:C++中使用函数模板出现“无法解析的外部符号”问题
解决方法:
法1:将类的声明和定义放在同一个.h文件中;
法2:在类模板出现的cpp文件对应的.h文件中include xx.cpp文件;
法3:在主函数所在的main中include xx.cpp文件。
Error12:1>xxx\pcl 1.8.1\3rdparty\boost\include\boost-1_64\boost\typeof\msvc\typeof_impl.hpp(125): error C2143: 语法错误: 缺少“;”(在“<”的前面)
1>xxx\pcl 1.8.1\3rdparty\boost\include\boost-1_64\boost\typeof\msvc\typeof_impl.hpp(125): error C2913: 显式专用化;“boost::type_of::id2type_impl”不是类模板的专用化
1>xxx\pcl 1.8.1\3rdparty\boost\include\boost-1_64\boost\typeof\msvc\typeof_impl.hpp(125): error C2059: 语法错误:“<”
1>xxx\pcl 1.8.1\3rdparty\boost\include\boost-1_64\boost\typeof\msvc\typeof_impl.hpp(126): error C2334: “{”的前面有意外标记;跳过明显的函数体
点集错误指向同一行代码
template<typename ID, typename T>
struct msvc_extract_type : msvc_extract_type<ID,msvc_extract_type_default_param>
{
template<>
struct id2type_impl<true> //VC8.0 specific bugfeature
{
typedef T type;
};
template<bool>
struct id2type_impl;
typedef id2type_impl<true> id2type;
};
解决方案:在包含的所有源文件前添加以下代码
#define BOOST_TYPEOF_EMULATION
或
#define BOOST_TYPEOF_COMPLIANT
例如:
#define BOOST_TYPEOF_EMULATION //添加于此
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/search/kdtree.h>
Error13:error C2338: You've instantiated std::aligned_storage<Len, Align> with an extended alignment (in other words, Align > alignof(max_align_t)).
Before VS 2017 15.8, the member type would non-conformingly have an alignment of only alignof(max_align_t).
VS 2017 15.8 was fixed to handle this correctly, but the fix inherently changes layout and breaks binary compatibility (*only* for uses of
aligned_storage with extended alignments). Please define either (1) _ENABLE_EXTENDED_ALIGNED_STORAGE to acknowledge that you understand this
message and that you actually want a type with an extended alignment, or (2) _DISABLE_EXTENDED_ALIGNED_STORAGE to silence this message and
get the old non-conformant behavior.
解决方法:打开 项目属性页 -- > C/C++ --> 预处理器--> 预处理定义,添加定义如下:
方式一:
_DISABLE_EXTENDED_ALIGNED_STORAGE
方式二:
_ENABLE_EXTENDED_ALIGNED_STORAGE
Erro14:C4996 'pcl::SAC_SAMPLE_SIZE': This map is deprecated and is kept only to prevent breaking existing user code. Starting from PCL 1.8.0 model sample size is a protected member of the SampleConsensusModel class pclProject d:\softwaredesign\vs2017\pcl_dir\pcl 1.8.1\include\pcl-1.8\pcl\sample_consensus\model_types.h 99
解决办法:右击工程->属性页->C/C++->常规->SDL检查->否
Erro15:由于找不到MSVCR100.dll,无法继续执行代码。重新安装程序可能会解决此问题
解决办法:电脑管家->电脑诊所->软件使用异常->启动软件提示dll丢失->一键修复
Erro16:C4996: 'Eigen::AlignedBit': 被声明为已否决
解决办法(待验证):解决办法:右击工程->属性页->C/C++->常规->SDL检查->否
Erro17:error C2440: “初始化”: 无法从“std::shared_ptr<pcl::PointIndices>”转换为“boost::shared_ptr<pcl::PointIndices>”
解决办法:将“std::shared_ptr<pcl::PointIndices>”改成“boost::shared_ptr<pcl::PointIndices>”
Erro18:error LNK2005:"XXX已经在 XXX.obj 中定义
解决办法:在定义的函数或者变量前加了static ,编译成功且调用函数成功。
Erro19:correspondence.h(75): error C2589: “(”:“::”右边的非法标记
原因:可能代码里有#defined max或者windows.h头文件定义在pcl文件头之前
解决方案:
(1)调换头文件(PCL与其他头文件)的位置
(2)或者在#include<windows.h>之前加入 #define NOMINMAX
(3)或者在#include pcl头文件之前使用#undef max
Erro20:error C2079: “pcl::KdTreeFLANN<PointT,flann::L2_Simple<float>>::param_k_”使用未定义的 struct“flann::SearchParams”
解决办法:
将PCL的头文件提升到OpenCV的头文件上面,或者将pcl属性列表pcl.props移到opencv属性列表opencv.props上面。
Erro21:Assertion failed: px != 0, file d:\softwaredesign\vs2017\pcl_dir\pcl 1.8.1\3rdparty\boost\include\boost-1_64\boost\smart_ptr\shared_ptr.hpp, line 704
解决办法:定义变量须先初始化:如: PointCloud::Ptr keypoints改成 PointCloud::Ptr keypoints(new PointCloud);
Erro22:ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail.
解决方法:
在工程加上预编译宏:C/C++ --> 预处理器 --> 预处理器定义 --> 加上
GLOG_NO_ABBREVIATED_SEVERITIES
宏定义 保存,编译。
Erro23:VS编译出现‘itoa‘: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant
解决办法:在(项目 ---> XX属性页 ---> C/C++ ---> 预处理器 )添加如下宏定义:
_CRT_NONSTDC_NO_DEPRECATE
_CRT_SECURE_NO_WARNINGS(可省略)
或可直接在代码开头添加如下:
#define _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_SECURE_NO_WARNINGS
Erro23: error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
解决办法:在(项目 ---> XX属性页 ---> C/C++ ---> 预处理器 )添加如下宏定义:
_CRT_SECURE_NO_WARNINGS
或 右击工程->属性页->C/C++->常规->SDL检查->否
Erro24:代码移植过程中出现:fatal error C1083: 无法打开包括文件: “sys/time.h”: No such file or directory
解决办法:在(项目 ---> XX属性页 ---> C/C++ ---> 预处理器 )添加宏定义:_WINDOWS
Erro25:fatal error C1128: 节数超过对象文件格式限制: 请使用 /bigobj 进行编译
解决办法:在(项目 ---> XX属性页 ---> C/C++ ---> 命令行 -->其他选项 ,添加:/bigobj
Erro26:error C2760:语法错误: 意外的令牌“标识符”,预期的令牌为“类型说明符”
解决办法:
C/C++ -> 语言 -> 符合模式,修改为否
Error26:在调试重建程序时,发现报错:0x00007FF6DF5D6BD8 处有未经处理的异常(在 xxx.exe 中): 0xC00000FD: Stack overflow (参数: 0x0000000000000001, 0x0000004085203000)。
错误分析:栈溢出了。说明栈不够大,或者递归太深。
解决方案:
方案一:结合程序,设置递归项次数在一定次数以内;
方案二:修改栈大小:右键项目-> XX属性页---> 链接器---> 系统---> 堆栈保留大小,赋值20000000。
Error27:
C2027使用了未定义类“Eigen::LDLT<Eigen::Matrix<double,6,6,0,6,6>,1>”
解决办法:添加头文件 #include <Eigen/Cholesky>
Error28:CV_RGB2GRAY”: 未声明的标识符
解决办法:添加头文件
#include <opencv2/imgproc/types_c.h>
Error28:cuda 自定义函数调用时出现: error LNK2001: 无法解析的外部符号 "void __cdecl printHello(int)" (?printHello@@YAXH@Z)
解决办法:右键xx.cu文件-> xx.cu属性页--->常规---> 项类型---> CUDA C/C++
Error29:error C3083: “this_thread”:“::”左侧的符号必须是一种类型;
error C2039: "sleep": 不是 "boost" 的成员;
error C3083: “posix_time”:“::”左侧的符号必须是一种类型
error C3861: “microseconds”: 找不到标识符
解决方法一:
将boost::this_thread::sleep(boost::posix_time::microseconds(100000));
改为:std::this_thread::sleep_for(std::chrono::seconds(1));
或者:std::this_thread::sleep_for(std::chrono::microseconds(100000));
同时添加头文件
#include <thread> //对应的 std::this_thread::sleep_for#include <chrono> //对应的 std::chrono::seconds
解决方法二:
添加头文件 #include <boost/thread/thread.hpp>
Error29:error C3861: “pop_t”: 找不到标识符
解决办法:将typedef unsigned long long pop_t;
放到#if __GNUC__前面即可。
Error30: C4996 'pcl::SAC_SAMPLE_SIZE': This map is deprecated and is kept only to prevent breaking existing user code. Starting from PCL 1.8.0 model sample size is a protected member of the SampleConsensusModel class Project d:\automation\vs2017\pcl_dir\pcl 1.8.1\include\pcl-1.8\pcl\sample_consensus\model_types.h 99
解决办法:
打开项目属性页>C/C++>常规>SDL检查(设置为否)。
Error31:error C2381: “exit” : 重定义;__declspec(noreturn) 不同
解决办法:
一、
#if defined(_WIN32)
# ifndef GLUT_BUILDING_LIB
extern _CRTIMP void __cdecl exit(int);
二、
解决方法:#include <GL/glut.h>
#include <stdlib.h>
改成:
#include <stdlib.h>
#include <GL/glut.h>
Error31:error LNK2001: 无法解析的外部符号 glad_glLinkProgram
原因分析:error LNK2001: 无法解析的外部符号 _glad_ 这类错误;
解决办法:将 glad.c 添加到工程中。
Error32:1>glew32s.lib(glew.obj) : error LNK2005: glewGetErrorString 已经在 glew32.lib(glew32.dll) 中定义
1>glew32s.lib(glew.obj) : error LNK2005: glewGetString 已经在 glew32.lib(glew32.dll) 中定义
1>glew32s.lib(glew.obj) : error LNK2005: glewInit 已经在 glew32.lib(glew32.dll) 中定义
1>F:\WorkSpace\_Render\Code\Render\x64\Release\Render.exe : fatal error LNK1169: 找到一个或多个多重定义的符号
解决办法:调换附加依赖项的顺序,如下:
glew32s.lib
glew32.lib
Error33:error C1060: 编译器的堆空间不足
解决办法:打开工程项目的xxx.vcxproj文件-> 搜索“Globals”,找到 <PropertyGroup Label="Globals">,在下面加上<PreferredToolArchitecture>x64</PreferredToolArchitecture>
例如:
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{BFD25C6B-69AC-4F05-BBDC-A8F4256A479D}</ProjectGuid>
<RootNamespace>Project</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
修改为:
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{BFD25C6B-69AC-4F05-BBDC-A8F4256A479D}</ProjectGuid>
<RootNamespace>Project</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
Error34: VS2017下解决:无法解析的外部符号_vsnprintf
LNK2001 无法解析的外部符号 __vsnwprintf SimpleSample11 C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\C++\Direct3D11\SimpleSample11\dxerr.lib(dxerrw.obj)
解决方案有2种:
1、直接在项目的链接库--》输入--》附加依赖项中添加
legacy_stdio_definitions.lib
2、在报错的源文件中添加如下编译预处理指令
#pragma comment(lib, "legacy_stdio_definitions.lib")
Error35:VS2017+CUDA9.2,编译时出现 #error -- unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported! 是因为vs2017版本不兼容的原因。
解决办法:将
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include\crt\host_config.h
第131行
#if _MSC_VER < 1600 || _MSC_VER > 1913
改为
#if _MSC_VER < 1600 || _MSC_VER > 1950
(针对host_config.h修改后无法保存:先将其复制到其他地方修改好后再粘贴回来覆盖掉原来的文件)
Error35:在vs与Qt中出现,cannot find qmake.make sure you have specified a qt version
解决方案如下:在Qt VS Tools中找到Qt versions选项卡,Add 输入Qt版本编号(如:Name 为Qt5.9.9 Path为qmake.exe所在的bin目录。注意路径为bin文件夹所在目录,不需要包含bin)