gpt4 book ai didi

c++ - fatal error C1083 : Cannot open include file: 'Item.h” ': No such file or directory

转载 作者:行者123 更新时间:2023-11-27 23:11:30 24 4
gpt4 key购买 nike

我有一个名为 factory.cpp 的 .cpp 文件,如下所示:(刚刚启动程序)

#include "stdafx.h"
#include "Item.h”
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <ctime>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}

我的 item.h 看起来像这样:

#ifndef ITEM_H
#define ITEM_H

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <ctime>

Class Item{
public:
...

private:
...
};

#endif

当我尝试编译时,出现以下错误: fatal error C1083:无法打开包含文件:“Item.h”':没有这样的文件或目录。

我检查过,我的cpp文件和头文件都位于以下目录:

c:\Users\User\documents\visual studio 2010\Projects\factory\factory\

为了安全起见,我什至将这个目录添加到其他包含的目录中,但仍然没有成功......我正在使用 Microsoft Visual Studio 2010 Express,非常感谢您的帮助。谢谢!

最佳答案

你的包含是错误的,你必须使用“,而不是”。你有:

#include "Item.h”

你应该:

#include "Item.h"

关于c++ - fatal error C1083 : Cannot open include file: 'Item.h” ': No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20018640/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com