简体   繁体   English

c ++致命错误c1083项目之前很好,现在怎么办?

[英]c++ fatal error c1083 project was fine before, what now?

I have a (com) c++ project, which uses a (.net) c++ dll. 我有一个(com)c ++项目,它使用(.net)c ++ dll。 The project was compiling and running ok. 该项目正在编译并运行正常。

Now, all I did was make changes to the dll, and I'm getting a fatal error c1083- cannot open include file stdafx.h - when recompiling my (com) project. 现在,我所做的就是对dll进行更改,并且我遇到致命错误c1083-无法打开包含文件stdafx.h - 重新编译my(com)项目时。

What can this mean? 这意味着什么?

Look for your stdafx.h. 找你的stdafx.h。 Here are the possibilities: 以下是可能性:

  1. If it isn't missing, try restarting you machine. 如果没有丢失,请尝试重新启动计算机。 You could also use sysinternals' handle.exe to find out who's holding that file. 您还可以使用sysinternals的handle.exe来查找谁持有该文件。
  2. If it is missing, create it. 如果缺少,请创建它。
  3. On the other hand, it may be possible that your project did not originally use pre-compiled headers and the option was turned on in error. 另一方面,您的项目可能最初没有使用预编译的标题,并且错误地打开了该选项。 So, switch off the pre-compiled header option in project properties. 因此,请关闭项目属性中的预编译头选项。

If your include statement uses angle brackets: 如果include语句使用尖括号:

#include <stdafx.h>

...try changing it to use quotes instead: ...尝试将其更改为使用引号:

#include "stdafx.h"

The two are different. 两者不同的。 When you use quotes you tell the compiler "ok first search the local directory, then go to the search path." 当您使用引号时,您告诉编译器“确定首先搜索本地目录,然后转到搜索路径”。 But when you use angle brackets you tell the compiler "DONT look in the local directory, just search the search path." 但是当你使用尖括号时,你告诉编译器“不要在本地目录中查找,只需搜索搜索路径”。 In the case of stdafx.h you want the one that is part of the project, so you want to search the local directory first. 对于stdafx.h,您需要属于项目的那个,因此您希望首先搜索本地目录。

Which brings me to a pet peeve of mine, but that's a story for another show... 这让我感到很害羞,但这是另一个节目的故事......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM