CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2011
    Posts
    144

    [RESOLVED] error C2143: syntax error : missing ';' before '*'

    Hey guys, I was trying to write a character controller but when I went to add my pointer to my character I get error C2143: syntax error : missing ';' before '*'

    I've looked at all my classes involved but I don't see any errors and Visual Studio doesn't report any other specific errors. Is there any way of finding the source of this type of error?
    Last edited by drwbns; October 3rd, 2012 at 08:33 AM.

  2. #2
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,539

    Re: error C2143: syntax error : missing ';' before '*'

    Yes there is....post the offending line of code....and several before and after so we can help you fix your problem...
    Jim
    ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII

    "The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.

    "Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.

  3. #3
    Join Date
    Mar 2011
    Posts
    144

    Re: error C2143: syntax error : missing ';' before '*'

    ok -
    <code>
    void updateCameraGoal(Real deltaYaw, Real deltaPitch, Real deltaZoom)
    {
    mCameraPivot->yaw(Degree(deltaYaw), Node::TS_WORLD);

    // bound the pitch
    if (!(mPivotPitch + deltaPitch > 25 && deltaPitch > 0) &&
    !(mPivotPitch + deltaPitch < -60 && deltaPitch < 0))
    {
    mCameraPivot->pitch(Degree(deltaPitch), Node::TS_LOCAL);
    mPivotPitch += deltaPitch;
    }

    Real dist = mCameraGoal->_getDerivedPosition().distance(mCameraPivot->_getDerivedPosition());
    Real distChange = deltaZoom * dist;

    // bound the zoom
    if (!(dist + distChange < 8 && distChange < 0) &&
    !(dist + distChange > 25 && distChange > 0))
    {
    mCameraGoal->translate(0, 0, distChange, Node::TS_LOCAL);
    }
    }
    protected:
    CharacterOgre * mChar;
    </code>

    Why dont my code tags work? Offending line is CharacterOgre * mChar;

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: error C2143: syntax error : missing ';' before '*'

    Quote Originally Posted by drwbns View Post
    Why dont my code tags work?
    After 121 posts, you don't realize that code tags use square brackets?
    Offending line is CharacterOgre * mChar;
    So how can you use a type that the compiler doesn't know anything about? What is a "CharacterOgre"? I don't see that definition anywhere, and neither does the compiler.

    When you post code that doesn't compile, you should post all the code that you're trying to compile. If I took what you posted, I would get a boatload of other errors.

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    Mar 2011
    Posts
    144

    Re: error C2143: syntax error : missing ';' before '*'

    Sorry, I don't post here very often and a lot of other sites use <code> for tags. But I solved the problem, I had 2 headers including each other

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured