再记【fatal error C1001: 内部编译器错误】的一个原因

2023-11-01 21:52

本文主要是介绍再记【fatal error C1001: 内部编译器错误】的一个原因,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

平台:Windows 11、Visual Studio 2022

报错信息

已启动生成...
1>------ 已启动生成: 项目: PointMatchingModel, 配置: Debug x64 ------
1>PointMatchingModel.cpp
1>C:\tools\vcpkg\installed\x64-windows\include\pcl\registration\impl\ia_fpcs.hpp(236,1): fatal  error C1001: 内部编译器错误。
1>(编译器文件“D:\a\_work\1\s\src\vctools\Compiler\CxxFE\sl\p1\c\error.h”,第 1298)
1> 要解决此问题,请尝试简化或更改上面所列位置附近的程序。
1>如果可以,请在此处提供重现步骤: https://developercommunity.visualstudio.com
1>请选择 Visual C++
1>“帮助”菜单上的“技术支持”命令,或打开技术支持帮助文件来获得详细信息。
1>已完成生成项目“PointMatchingModel.vcxproj”的操作 - 失败。
========== 生成: 0 成功,1 失败,0 最新,0 已跳过 ==========
========= 生成 开始于 15:02,并花费了 06.996 秒 ==========

问题分析

该问题类型为内部编译器错误。

但 Visual Studio 并没有检测出代码的语法问题。

导致这个问题的原因比较多,但缺乏足够有用的信息,只能一点点检查。

在《【fatal error C1001: 内部编译器错误】的一个原因》里,我提到是自己写的一个 Lambda 表达式中没写分号 ;

但这次的问题出现在 pcl\registration\impl\ia_fpcs.hpp 上,这是 PCL 官方的文件,讲道理不可能出问题。

国内的网站上无法检索相关的解决办法,所以尝试在外网找找,那就需要先把 Visual Studio 2022 改成英文,然后用英文的报错信息去搜索。

于是按照《Visual studio的中英文切换》中的方式切换为了中文,然后对项目重新编译了一下,希望得到英文版的报错信息后,在外网搜搜。但此时 VS 提供的报错信息的内容比中文版时更丰富了

Build started...
1>------ Build started: Project: PointMatchingModel, Configuration: Debug x64 ------
1>PointMatchingModel.cpp
1>C:\tools\vcpkg\installed\x64-windows\include\pcl\registration\impl\ia_fpcs.hpp(225,7): error C2760: syntax error: '}' was unexpected here; expected 'statement'
1>Done building project "PointMatchingModel.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 15:12 and took 11.141 seconds ==========

找了一下,没找到原因。

看一下 ia_fpcs.hpp 的代码(含行号):

165 ///
166 template <typename PointSource, typename PointTarget, typename NormalT, typename Scalar>
167 void
168 pcl::registration::FPCSInitialAlignment<PointSource, PointTarget, NormalT, Scalar>::
169     computeTransformation(PointCloudSource& output, const Eigen::Matrix4f& guess)
170 {
171   if (!initCompute())
172     return;
173 
174   final_transformation_ = guess;
175   bool abort = false;
176   std::vector<MatchingCandidates> all_candidates(max_iterations_);
177   pcl::StopWatch timer;
178 
179 #pragma omp parallel default(none) shared(abort, all_candidates, timer)                \
180     num_threads(nr_threads_)
181   {
182 #ifdef _OPENMP
183     const unsigned int seed =
184         static_cast<unsigned int>(std::time(NULL)) ^ omp_get_thread_num();
185     std::srand(seed);
186     PCL_DEBUG("[%s::computeTransformation] Using seed=%u\n", reg_name_.c_str(), seed);
187 #pragma omp for schedule(dynamic)
188 #endif
189     for (int i = 0; i < max_iterations_; i++) {
190 #pragma omp flush(abort)
191 
192       MatchingCandidates candidates(1);
193       pcl::Indices base_indices(4);
194       all_candidates[i] = candidates;
195 
196       if (!abort) {
197         float ratio[2];
198         // select four coplanar point base
199         if (selectBase(base_indices, ratio) == 0) {
200           // calculate candidate pair correspondences using diagonal lengths of base
201           pcl::Correspondences pairs_a, pairs_b;
202           if (bruteForceCorrespondences(base_indices[0], base_indices[1], pairs_a) ==
203                   0 &&
204               bruteForceCorrespondences(base_indices[2], base_indices[3], pairs_b) ==
205                   0) {
206             // determine candidate matches by combining pair correspondences based on
207             // segment distances
208             std::vector<pcl::Indices> matches;
209             if (determineBaseMatches(base_indices, matches, pairs_a, pairs_b, ratio) ==
210                 0) {
211               // check and evaluate candidate matches and store them
212               handleMatches(base_indices, matches, candidates);
213               if (!candidates.empty())
214                 all_candidates[i] = candidates;
215             }
216           }
217         }
218 
219         // check terminate early (time or fitness_score threshold reached)
220         abort = (!candidates.empty() ? candidates[0].fitness_score < score_threshold_
221                                      : abort);
222         abort = (abort ? abort : timer.getTimeSeconds() > max_runtime_);
223 
224 #pragma omp flush(abort)
225       }
226     }
227   }
228 
229   // determine best match over all tries
230   finalCompute(all_candidates);
231 
232   // apply the final transformation
233   pcl::transformPointCloud(*input_, output, final_transformation_);
234 
235   deinitCompute();
236 }

根据错误提示,说是 '}' was unexpected here; expected 'statement',尝试把第 224 行注释掉了。然后再编译就成功了。

还是 不知道什么原因

教训:开发工具还是用英文比较好,报错的信息更全。

这篇关于再记【fatal error C1001: 内部编译器错误】的一个原因的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/326005

相关文章

javax.net.ssl.SSLHandshakeException:异常原因及解决方案

《javax.net.ssl.SSLHandshakeException:异常原因及解决方案》javax.net.ssl.SSLHandshakeException是一个SSL握手异常,通常在建立SS... 目录报错原因在程序中绕过服务器的安全验证注意点最后多说一句报错原因一般出现这种问题是因为目标服务器

SpringBoot排查和解决JSON解析错误(400 Bad Request)的方法

《SpringBoot排查和解决JSON解析错误(400BadRequest)的方法》在开发SpringBootRESTfulAPI时,客户端与服务端的数据交互通常使用JSON格式,然而,JSON... 目录问题背景1. 问题描述2. 错误分析解决方案1. 手动重新输入jsON2. 使用工具清理JSON3.

MyBatis Plus 中 update_time 字段自动填充失效的原因分析及解决方案(最新整理)

《MyBatisPlus中update_time字段自动填充失效的原因分析及解决方案(最新整理)》在使用MyBatisPlus时,通常我们会在数据库表中设置create_time和update... 目录前言一、问题现象二、原因分析三、总结:常见原因与解决方法对照表四、推荐写法前言在使用 MyBATis

如何解决Druid线程池Cause:java.sql.SQLRecoverableException:IO错误:Socket read timed out的问题

《如何解决Druid线程池Cause:java.sql.SQLRecoverableException:IO错误:Socketreadtimedout的问题》:本文主要介绍解决Druid线程... 目录异常信息触发场景找到版本发布更新的说明从版本更新信息可以看到该默认逻辑已经去除总结异常信息触发场景复

IDEA中Maven Dependencies出现红色波浪线的原因及解决方法

《IDEA中MavenDependencies出现红色波浪线的原因及解决方法》在使用IntelliJIDEA开发Java项目时,尤其是基于Maven的项目,您可能会遇到MavenDependenci... 目录一、问题概述二、解决步骤2.1 检查 Maven 配置2.2 更新 Maven 项目2.3 清理本

Python struct.unpack() 用法及常见错误详解

《Pythonstruct.unpack()用法及常见错误详解》struct.unpack()是Python中用于将二进制数据(字节序列)解析为Python数据类型的函数,通常与struct.pa... 目录一、函数语法二、格式字符串详解三、使用示例示例 1:解析整数和浮点数示例 2:解析字符串示例 3:解

Java空指针异常NullPointerException的原因与解决方案

《Java空指针异常NullPointerException的原因与解决方案》在Java开发中,NullPointerException(空指针异常)是最常见的运行时异常之一,通常发生在程序尝试访问或... 目录一、空指针异常产生的原因1. 变量未初始化2. 对象引用被显式置为null3. 方法返回null

CentOS 7 YUM源配置错误的解决方法

《CentOS7YUM源配置错误的解决方法》在使用虚拟机安装CentOS7系统时,我们可能会遇到YUM源配置错误的问题,导致无法正常下载软件包,为了解决这个问题,我们可以替换YUM源... 目录一、备份原有的 YUM 源配置文件二、选择并配置新的 YUM 源三、清理旧的缓存并重建新的缓存四、验证 YUM 源

python3 pip终端出现错误解决的方法详解

《python3pip终端出现错误解决的方法详解》这篇文章主要为大家详细介绍了python3pip如果在终端出现错误该如何解决,文中的示例方法讲解详细,感兴趣的小伙伴可以跟随小编一起了解一下... 目录前言一、查看是否已安装pip二、查看是否添加至环境变量1.查看环境变量是http://www.cppcns

python进行while遍历的常见错误解析

《python进行while遍历的常见错误解析》在Python中选择合适的遍历方式需要综合考虑可读性、性能和具体需求,本文就来和大家讲解一下python中while遍历常见错误以及所有遍历方法的优缺点... 目录一、超出数组范围问题分析错误复现解决方法关键区别二、continue使用问题分析正确写法关键点三