我有一个名为 simpio.h 的头文件,它与包含在其头文件中的文件位于同一文件夹中。但是,我不断收到错误“无法打开包含文件:'simpio.h':没有这样的文件或目录。” 我正在使用 Visual C++ 2008 速成版。帮助将不胜感激。
谢谢
我有一个名为 simpio.h 的头文件,它与包含在其头文件中的文件位于同一文件夹中。但是,我不断收到错误“无法打开包含文件:'simpio.h':没有这样的文件或目录。” 我正在使用 Visual C++ 2008 速成版。帮助将不胜感激。
谢谢
您需要使用双引号:
#include "simpio.h"
You have to know that you should use <>
when you are trying to include a standard library header or when you want to include a file for which the path is contained in the Additional include directories
option.
You have to use ""
when you whant to include a file who doesn't satified the previous explanation, let's say that it is almost always file specific to your project.
Some example :
#include <iostream> // library file
#include <boost/thread.hpp> // there is "C:\SDKS\boost in my Additional include directories
#include "MyHeader.h" // Local file, at the same place of my .vcproj
#include "Header/AnotherHeader.h" // Local file in a folder named "Header"
In your case, we can think that you are in the second case. You just have to do :
#include "simpio.h"
Or if your file is in another folder :
#include "SomeFolders/simpio.h"