当前位置: 首页 > news >正文

再记【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 行注释掉了。然后再编译就成功了。

还是 不知道什么原因

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

http://www.lryc.cn/news/214051.html

相关文章:

  • 数据分析、大数据分析和人工智能之间的区别
  • Spring系列之基础
  • Android开发知识学习——TCP / IP 协议族
  • 思维训练 第四课 省略句
  • soul协议算法
  • 电子产品的认证体系
  • 大厂面试题-网络四元组
  • 【通义千问“助力用户运营,无代码开发实现API连接广告推广和CRM】
  • 数据结构第一课-----------数据结构的介绍
  • Python武器库开发-常用模块之OS模块(十一)
  • Vectrosity 插件使用
  • 数据结构详细笔记——并查集
  • transformers-Generation with LLMs
  • maven之父子工程版本控制案例实战,及拓展groupId和artifactId的含义
  • 100量子比特启动实用化算力标准!玻色量子重磅发布相干光量子计算机
  • JAVA基础(JAVA SE)学习笔记(十)多线程
  • ChatGPT参数只有200亿?扩散代码模型,意外泄露
  • VR虚拟仿真教学在建筑学课堂中的应用
  • 竞赛 深度学习实现行人重识别 - python opencv yolo Reid
  • 当代都市的时尚先锋:气膜建筑的魅力
  • 品牌加盟商做信息展示预约小程序的效果如何
  • delphi 11.3 FastReport 多设备跨平台 打印之解决方法
  • 配置vue 环境
  • Visio文件编辑查看工具Visio Viewer for Mac
  • 现在软文发布平台都有哪些?如何在正规媒体发稿?
  • 【卷积神经网络】YOLO 算法原理
  • 云计算与ai人工智能对高防cdn的发展
  • Web3时代:探索DAO的未来之路
  • odbcinst文件
  • (CQUPT 的某数据结构homework)