首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >PCH警告:标题停止不能在宏中或#if块中- Visual C++ 2010速成版SP1

PCH警告:标题停止不能在宏中或#if块中- Visual C++ 2010速成版SP1
EN

Stack Overflow用户
提问于 2011-05-15 01:32:38
回答 10查看 66.8K关注 0票数 70

这是从一个网站上粘贴过来的,大概是正常工作的。我做了一些谷歌搜索,发现我现在遇到的问题是我今天下载的Visual C++ 2010 SP1的结果,现在给我这个错误:

PCH Warning: header stop cannot be in a macro or #if block.

希望有人能帮我解决这个问题!

代码语言:javascript
运行
复制
#ifndef APP_STATE_H
#define APP_STATE_H

#include "Framework.h"

class AppState; //this line is giving me the error

//define two classes

#endif

Framework.h:

代码语言:javascript
运行
复制
#ifndef OGRE_FRAMEWORK_H
#define OGRE_FRAMEWORK_H

#include <OgreCamera.h>
#include <OgreEntity.h>
#include <OgreLogManager.h>
#include <OgreOverlay.h>
#include <OgreOverlayElement.h>
#include <OgreOverlayManager.h>
#include <OgreRoot.h>
#include <OgreViewport.h>
#include <OgreSceneManager.h>
#include <OgreRenderWindow.h>
#include <OgreConfigFile.h>

#include <OISEvents.h>
#include <OISInputManager.h>
#include <OISKeyboard.h>
#include <OISMouse.h>

class OgreFramework : public Ogre::Singleton<OgreFramework>,OIS::KeyListener,OIS::MouseListener{
public:
    OgreFramework();
    ~OgreFramework();

    bool initOgre(Ogre::String wndTitle, OIS::KeyListener *pKeyListener = 0, OIS::MouseListener *pMouseListener = 0);
    void updateOgre(double timeSinceLastFrame);

    //OIS
    bool keyPressed(const OIS::KeyEvent &keyEventRef);
    bool keyReleased(const OIS::KeyEvent &keyEventRef);
    bool mouseMoved(const OIS::MouseEvent &evt);
    bool mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID id);
    bool mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID id);

    Ogre::Root* mRoot;
    Ogre::RenderWindow* mRenderWnd;
    Ogre::Viewport* mViewport;
    Ogre::Log* mLog;
    Ogre::Timer* mTimer;

    //OIS
    OIS::InputManager* mInputMgr;
    OIS::Keyboard* mKeyboard;
    OIS::Mouse* mMouse;
private:
    OgreFramework(const OgreFramework&);
    OgreFramework& operator= (const OgreFramework&);
};

#endif
EN

回答 10

Stack Overflow用户

回答已采纳

发布于 2011-06-08 00:07:16

我也遇到了同样的问题,正在寻找解决方案。下面的内容对我很有效:

在文件的开头添加#pragma once (甚至在#ifndef APP_STATE_H头保护之前)

票数 94
EN

Stack Overflow用户

发布于 2011-05-15 02:40:12

您可能使用了项目模板来开始,并丢弃了预先生成的源代码文件。那些项目模板喜欢打开预编译头文件,因为它非常节省时间。右击“解决方案资源管理器”窗口中的“属性”、“C/C++”、“预编译头”中的项目。将“预编译头”设置更改为“不使用”。

票数 15
EN

Stack Overflow用户

发布于 2014-12-09 16:30:29

1.关闭项目。2.重新打开项目,一切正常。这是我的探险。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6003603

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档