VS2008驱动项目A,集成一个Wzarid生成的驱动LIB项目B,在编译64位驱动时,出现以下错误:
1>------ Build started: Project: xxxx, Configuration: Release x64 ------
1>Linking...
1>fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'f:\dd\vctools\compiler\utc\src\p2\p2symtab.c', line 1823)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1>Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1>LINK : fatal error LNK1257: code generation failed
1>xxxx - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
首先确定是新引入的LIB引起的这个编译器错误,经过查看 C1001 错误的微软官方文档解释,如果错误路径是UTC目录下的,很可能是优化导致的此问题,只能挨个关闭LIB的优化选项来定位具体是哪个优化导致的;
最终定位到是GL选项导致此问题,关闭即可
如果是VS管理的项目,在C/C++ ===> Optimization ===》 Whole Program Opimization选项中设置为NO 即可关闭GL;
如果是DKKWarizd生成的项目,可以在source文件中加入一行,即可关闭GL
USER_C_FLAGS=/GL-
主要影响是关闭GL后,生成的LIB文件变小了
引用:
- https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/fatal-error-c1001?view=msvc-170