智能感知:无法打开源文件“enum.h”

时间:2022-12-25 15:05:04
#include "enum.h"

Using visual studio's the code above is what I had typed, in fact once I typed the double quotes it automatically provided me a list of all available header files in the directory the file I was working on was located.

使用visual studio的代码是我所键入的,事实上,一旦我输入了双引号,它就会自动为我提供一个目录中所有可用的头文件的列表。

It is also included under "Header Files", it certainly sees the file there, but intellisense isn't detecting it; additionally it seems to also be causing some other syntax errors further along the line, so I want to rule this out as an issue.

它也包含在“头文件”中,它当然看到了文件,但是智能感知并没有检测到它;此外,它似乎还导致了一些其他的语法错误,所以我想把它排除为一个问题。

I read there was something about typing the path in the properties > VC++ Directories > Include Directories but I have no idea what the proper syntax is to make sure its properly included. Do I just need to link the route folder for my project or each individual header file?

我读到过,在> vc++目录中键入路径的内容包括目录,但我不知道正确的语法是什么,以确保正确地包含它。我需要为我的项目或每个单独的头文件链接路由文件夹吗?

It didn't use to cause this problem but at random now it does.

它不是用来造成这个问题的,但现在它是随机的。

Edit: At some point after some unreproducible fiddling some of them work, though others don't for no explainable reason. Sometimes it will "work" and Intellisense won't complain, but after compiling, bam, error pops up again.

编辑:在某些时候,一些不可复制的东西使其中的一些工作完成,而另一些则没有解释的原因。有时它会“工作”,智能感知不会抱怨,但是在编译后,错误会再次出现。

2 个解决方案

#1


2  

Yes, you need to make sure the path of all your own include files are present in Properties > VC++ Directories > Include Directories, (you don't need to worry about the standard library include files as compiler will already be able to find those). The directories in here should be separated by a ;. If you don't want to type the directory in manually you can click the down arrow to the right of Include Directories > Edit... > Add Directory Icon, then browse to the directory of your include file and add it like that.

是的,您需要确保所有包含文件的路径都包含在> vc++目录中,>包含目录,(您不需要担心标准库包含文件,因为编译器已经能够找到这些文件)。这里的目录应该被a隔开;如果您不想手动输入目录,您可以单击包含目录>编辑的右边的向下箭头。添加目录图标,然后浏览到包含文件的目录,然后添加它。

#2


0  

Something to try:

一些尝试:

Right click the #include and click Open Document.

右击#include并单击Open Document。

  1. If it can open the file then the IntelliSense is corrupted, and you will probably need to regenerate the IntelliSense file.
  2. 如果它可以打开文件,那么智能感知就被损坏了,您可能需要重新生成智能感知文件。
  3. If the file won't open, it will give you a message with the current folder paths that are searched, so you can copy your files there or search why is that your path wasn't searched
  4. 如果文件不打开,它会给你一条消息,包含当前文件夹路径,你可以在那里复制你的文件,或者搜索为什么你的路径没有被搜索。

Check some other answers:

检查其他的答案:

link1

link1

link2

link2

link3

link3

#1


2  

Yes, you need to make sure the path of all your own include files are present in Properties > VC++ Directories > Include Directories, (you don't need to worry about the standard library include files as compiler will already be able to find those). The directories in here should be separated by a ;. If you don't want to type the directory in manually you can click the down arrow to the right of Include Directories > Edit... > Add Directory Icon, then browse to the directory of your include file and add it like that.

是的,您需要确保所有包含文件的路径都包含在> vc++目录中,>包含目录,(您不需要担心标准库包含文件,因为编译器已经能够找到这些文件)。这里的目录应该被a隔开;如果您不想手动输入目录,您可以单击包含目录>编辑的右边的向下箭头。添加目录图标,然后浏览到包含文件的目录,然后添加它。

#2


0  

Something to try:

一些尝试:

Right click the #include and click Open Document.

右击#include并单击Open Document。

  1. If it can open the file then the IntelliSense is corrupted, and you will probably need to regenerate the IntelliSense file.
  2. 如果它可以打开文件,那么智能感知就被损坏了,您可能需要重新生成智能感知文件。
  3. If the file won't open, it will give you a message with the current folder paths that are searched, so you can copy your files there or search why is that your path wasn't searched
  4. 如果文件不打开,它会给你一条消息,包含当前文件夹路径,你可以在那里复制你的文件,或者搜索为什么你的路径没有被搜索。

Check some other answers:

检查其他的答案:

link1

link1

link2

link2

link3

link3