Note that there are some explanatory texts on larger screens.

plurals
  1. POSyntax error missing ; before *
    primarykey
    data
    text
    <p>I have a header file like so:</p> <pre><code>#pragma once #include "gamestate.h" #include "ExitListener.h" class InitialGameState : public GameState { public: InitialGameState(Ogre::Camera *cam, Ogre::SceneManager *sceneMgr, OIS::Keyboard *keyboard, OIS::Mouse *mouse, Ogre::Root *root); ~InitialGameState(void); virtual bool update(Ogre::Real time); virtual void pause(void); virtual void start(void); void keyPressed(const OIS::KeyEvent &amp;e); void keyReleased(const OIS::KeyEvent &amp;e); //private: ExitListener *mFrameListener; }; </code></pre> <p>The problem with this is that I get the following errors from VC 8:</p> <pre><code>InitialGameState.h(16) : error C2143: syntax error : missing ';' before '*' InitialGameState.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int InitialGameState.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int </code></pre> <p>(they all refer to the last line)</p> <p>I have a class <code>ExitListener.h</code> which is why I don't get the errors</p> <p><em>Edit: ExitListener.h:</em></p> <pre><code>#pragma once #include &lt;Ogre.h&gt; #include &lt;OIS/OIS.h&gt; #include &lt;CEGUI/CEGUI.h&gt; #include &lt;OgreCEGUIRenderer.h&gt; #include "Thing.h" #include "InitialGameState.h" using namespace Ogre; class ExitListener : public FrameListener, public OIS::KeyListener, public OIS::MouseListener { public: ExitListener(OIS::Keyboard *keyboard, OIS::Mouse *mouse, Camera *cam, std::vector&lt;Thing*&gt; &amp;vec): mKeyboard(keyboard), r(0.09), mContinue(true), mRunningAnimation(false), mMouse(mouse), mYaw(0), mPitch(0), things(vec), mCamera(cam), mWDown(false), mSDown(false), mADown(false), mDDown(false) { things = vec; mKeyboard-&gt;setEventCallback(this); mMouse-&gt;setEventCallback(this); } bool frameStarted(const FrameEvent&amp; evt); bool keyPressed(const OIS::KeyEvent &amp;e); bool keyReleased(const OIS::KeyEvent &amp;e); bool mouseMoved(const OIS::MouseEvent &amp;e); bool mousePressed(const OIS::MouseEvent &amp;e, OIS::MouseButtonID id); bool mouseReleased(const OIS::MouseEvent &amp;e, OIS::MouseButtonID id); void setOwner(GameState *g); private: AnimationState *mSwim; Radian r; Radian mYaw; Radian mPitch; OIS::Keyboard *mKeyboard; OIS::Mouse *mMouse; Camera *mCamera; bool mContinue; bool mRunningAnimation; std::vector&lt;Thing*&gt; &amp;things; bool mWDown; bool mADown; bool mDDown; bool mSDown; GameState *mOwner; }; </code></pre> <p><em>Edit 2:</em></p> <p>It turned out that the problem could be solved by a forward declaration and then including the other header directly in my .cpp file.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload