再记【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

相关文章

C/C++错误信息处理的常见方法及函数

《C/C++错误信息处理的常见方法及函数》C/C++是两种广泛使用的编程语言,特别是在系统编程、嵌入式开发以及高性能计算领域,:本文主要介绍C/C++错误信息处理的常见方法及函数,文中通过代码介绍... 目录前言1. errno 和 perror()示例:2. strerror()示例:3. perror(

Go标准库常见错误分析和解决办法

《Go标准库常见错误分析和解决办法》Go语言的标准库为开发者提供了丰富且高效的工具,涵盖了从网络编程到文件操作等各个方面,然而,标准库虽好,使用不当却可能适得其反,正所谓工欲善其事,必先利其器,本文将... 目录1. 使用了错误的time.Duration2. time.After导致的内存泄漏3. jsO

Linux samba共享慢的原因及解决方案

《Linuxsamba共享慢的原因及解决方案》:本文主要介绍Linuxsamba共享慢的原因及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux samba共享慢原因及解决问题表现原因解决办法总结Linandroidux samba共享慢原因及解决

Spring事务中@Transactional注解不生效的原因分析与解决

《Spring事务中@Transactional注解不生效的原因分析与解决》在Spring框架中,@Transactional注解是管理数据库事务的核心方式,本文将深入分析事务自调用的底层原理,解释为... 目录1. 引言2. 事务自调用问题重现2.1 示例代码2.2 问题现象3. 为什么事务自调用会失效3

mysql出现ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost‘ (10061)的解决方法

《mysql出现ERROR2003(HY000):Can‘tconnecttoMySQLserveron‘localhost‘(10061)的解决方法》本文主要介绍了mysql出现... 目录前言:第一步:第二步:第三步:总结:前言:当你想通过命令窗口想打开mysql时候发现提http://www.cpp

找不到Anaconda prompt终端的原因分析及解决方案

《找不到Anacondaprompt终端的原因分析及解决方案》因为anaconda还没有初始化,在安装anaconda的过程中,有一行是否要添加anaconda到菜单目录中,由于没有勾选,导致没有菜... 目录问题原因问http://www.chinasem.cn题解决安装了 Anaconda 却找不到 An

Spring定时任务只执行一次的原因分析与解决方案

《Spring定时任务只执行一次的原因分析与解决方案》在使用Spring的@Scheduled定时任务时,你是否遇到过任务只执行一次,后续不再触发的情况?这种情况可能由多种原因导致,如未启用调度、线程... 目录1. 问题背景2. Spring定时任务的基本用法3. 为什么定时任务只执行一次?3.1 未启用

Python中ModuleNotFoundError: No module named ‘timm’的错误解决

《Python中ModuleNotFoundError:Nomodulenamed‘timm’的错误解决》本文主要介绍了Python中ModuleNotFoundError:Nomodulen... 目录一、引言二、错误原因分析三、解决办法1.安装timm模块2. 检查python环境3. 解决安装路径问题

如何解决mysql出现Incorrect string value for column ‘表项‘ at row 1错误问题

《如何解决mysql出现Incorrectstringvalueforcolumn‘表项‘atrow1错误问题》:本文主要介绍如何解决mysql出现Incorrectstringv... 目录mysql出现Incorrect string value for column ‘表项‘ at row 1错误报错

Java报NoClassDefFoundError异常的原因及解决

《Java报NoClassDefFoundError异常的原因及解决》在Java开发过程中,java.lang.NoClassDefFoundError是一个令人头疼的运行时错误,本文将深入探讨这一问... 目录一、问题分析二、报错原因三、解决思路四、常见场景及原因五、深入解决思路六、预http://www