PCH 경고 : 헤더 중지는 매크로 또는 #if 블록에있을 수 없음-Visual C ++ 2010 Express SP1
이것은 아마도 작동하는 웹 사이트에서 붙여 넣은 것입니다. 인터넷 검색을 수행 한 결과 현재 발생한 문제가 오늘 다운로드 한 Visual C ++ 2010 SP1의 결과라는 것을 발견했으며 이제이 오류가 발생합니다.
PCH Warning: header stop cannot be in a macro or #if block.
누군가가 나를 도울 수 있기를 바랍니다!
#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 :
#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
나는 같은 문제가 있었고 해결책을 찾고있었습니다. 다음은 나를 위해 일했습니다.
#pragma once
파일 시작 부분에 추가 ( #ifndef APP_STATE_H
헤더 가드 이전에도 )
You probably used a project template to get started and threw away the pre-generated source code files. Those project templates like to turn on precompiled headers because it is such a time-saver. Right-click your project in the Solution Explorer window, Properties, C/C++, Precompiled Headers. Change the "Precompiled Header" setting to "Not Using".
1.Close the Project. 2.Reopen the project,and all ok. this is my expeirence.
move the #include statements outside the #if #end block
Rebuilding IntelliSense database solves the problem.
- Close Visual Studio
- Delete [SolutionName].sdf
- Delete DllWrappers.opensdf
- Delete ipch folder
- Open Visual Studio
I had the same problem. My solution was to add a missing ';' at the end of a class definition. Although this does not seem to apply to your problem, others who come here with the same error might find this helpful.
This is probable a day late and a dollar short but I had the same error when I accidentally put my header file in a .cpp file instead of a .h file. I will post it though in case it can help someone.
I just added a referenct to the header file (#include "header.h") and it helped.
I found that my .h file was actually being treated as a .cpp file! Right click on the file in the Solution Explorer > All Configurations > Item Type: C/C++ header
Make sure the item type is not C/C++ compiler or other.
Once you add a .cpp file and have it include the header this error should go away. I've read some where else this is a bug.
I use Visual Studio to edit Linux projects. For me, the issue was present when I include string.h in my precompiled header file. It was caused by lines that have an __asm statement, for example:
__THROW __asm ("memchr") __attribute_pure__ __nonnull ((1));
The solution was to define the following macro under Project Properties, Configuration Properties, C/C++, Preprocessor, Preprocessor Defines:
__asm(x)=
'program tip' 카테고리의 다른 글
약속 후 반환 값 (0) | 2020.11.09 |
---|---|
클래스가 다른 클래스에서 상속되었는지 테스트 (0) | 2020.11.08 |
R에서 최대 인쇄 제한을 늘리는 방법 (0) | 2020.11.08 |
HTTP에서 캐시 제어 헤더의 최대 값 (0) | 2020.11.08 |
실행중인 인스턴스의 EBS 볼륨 크기를 늘리려면 어떻게해야합니까? (0) | 2020.11.08 |