C++ visual studio C2027 and C2011 errors



我正在开发一个游戏引擎,并在构建时遇到了这些错误

严重性代码描述项目文件行删除状态错误C2027使用未定义的类型"AssetManager"SharkEngine F:\Projects\C++SharkEngine\Text.h 10

严重性代码描述项目文件行删除状态错误C2011"AssetManager":重新定义类型"class"SharkEngine F:\Projects\C++\ SharkEngine\AssetManager.h 8

我找不到为什么会出现这些错误。这是我的代码:

Text.h(C2027错误的来源(

#pragma once
#include "AssetManager.h"
namespace Text
{
sf::Text NewText(std::string str, std::string font, sf::Color color, int charSize, AssetManager* manager)
{
sf::Text t;
t.setString(str);
t.setFont(*manager->GetFont(font));
t.setCharacterSize(charSize);
t.setFillColor(color);
return t;
}
};

AssetManager.h(C2011错误的来源(

#pragma once
#include<iostream>
#include<map>
#include<SFML/Graphics.hpp>
#include<SFML/Audio.hpp>
class AssetManager
{
private:
std::map<std::string, sf::Texture*> Textures;
std::map<std::string, sf::Font*> Fonts;
std::map<std::string, sf::SoundBuffer*> AudioClips;
public:
void LoadDir(std::string path, bool absolutePath = false);
#define LoadAllAssets() LoadDir("");
//texture
void LoadTexture(std::string path, std::string name);
sf::Texture* GetTexture(std::string name);
//font
void LoadFont(std::string path, std::string name);
sf::Font* GetFont(std::string name);
//sound buffer
void LoadAudioClips(std::string path, std::string name);
sf::SoundBuffer* GetAudioClips(std::string name);
};

请随时询问任何其他信息。感谢您抽出时间!

理解完这个问题后,我发现在代码的其他地方我做了一个错误的include(#include"SharkEngine/AssetManager.h"而不是"AssetManager.h"(。

最新更新