0
我使用Microsoft Visual C++ 2010的一個簡單的控制檯應用程序,但我有,包括我想打一個頭文件的麻煩配置文件包括一個新的文件夾中的頭文件「無法打開包含文件 - 沒有這樣的文件或目錄」
目錄看起來像這樣
-AI
--config
--config.h
--Header Files
--Resource Files
--Source Files
AI.cpp
// AI.cpp : main project file.
#include "stdafx.h"
#include <cstdio>
//include config file
#include "../config/config.h"
using namespace System;
using namespace std;
config c;
int main()
{
count << "My name is: " << c.getName;
std::getchar();
}
的config.h文件
Class config
{
public void getName(){
return 'Awesome'
}
}
當我點擊Build按鈕,我收到以下錯誤:
1>AI.cpp(7): fatal error C1083: Cannot open include file: 'config\config.h': No such file or directory
右鍵點擊包括並點擊Open Document「config.h」。如果VS不能解決路徑問題,你會得到一個錯誤,告訴你它看起來在哪裏。 – VoidStar
這就是解決方案資源管理器窗口的樣子。不是文件系統的樣子。像「頭文件」這樣的項目不是目錄,它們是「過濾器」。很可能「config」實際上並不是一個目錄。 –
感謝,我其實並沒有指定任何文件夾路徑...只是文件名「的config.h」和它的工作....其他比對功能的其他錯誤,但它似乎解決了這個問題,現在... – fxuser