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

时间:2022-05-15 09:45:42

I have a (com) c++ project, which uses a (.net) c++ dll. The project was compiling and running ok.

我有一个(com)c ++项目,它使用(.net)c ++ dll。该项目正在编译并运行正常。

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 - 重新编译我的(com)项目时。

What can this mean?

这意味着什么?

2 个解决方案

#1


1  

Look for your stdafx.h. Here are the possibilities:

找你的stdafx.h。以下是可能性:

  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.
  2. 如果没有丢失,请尝试重新启动计算机。您还可以使用sysinternals的handle.exe来查找谁持有该文件。

  3. If it is missing, create it.
  4. 如果缺少,请创建它。

  5. 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.
  6. 另一方面,您的项目可能最初没有使用预编译的标题,并且错误地打开了该选项。因此,请关闭项目属性中的预编译头选项。

#2


0  

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...

这让我感到很害羞,但这是另一场秀的故事......

#1


1  

Look for your stdafx.h. Here are the possibilities:

找你的stdafx.h。以下是可能性:

  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.
  2. 如果没有丢失,请尝试重新启动计算机。您还可以使用sysinternals的handle.exe来查找谁持有该文件。

  3. If it is missing, create it.
  4. 如果缺少,请创建它。

  5. 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.
  6. 另一方面,您的项目可能最初没有使用预编译的标题,并且错误地打开了该选项。因此,请关闭项目属性中的预编译头选项。

#2


0  

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...

这让我感到很害羞,但这是另一场秀的故事......