error C2146: syntax error : missing ';' before identifier 'vertices'

Posted by numerical25 on Stack Overflow See other posts from Stack Overflow or by numerical25
Published on 2010-04-24T21:41:26Z Indexed on 2010/04/24 21:43 UTC
Read the original article Hit count: 792

Filed under:
|
|
|

I would usually search for this error. But in VS C++ Express, this error comes up for just about every mistake you do. Any how I recieve this error below

error C2146: syntax error : missing ';' before identifier 'vertices'

everytime I add the following code at the top of my document

// Create vertex buffer
SimpleVertex vertices[] =
{
    D3DXVECTOR3( 0.0f, 0.5f, 0.5f ),
    D3DXVECTOR3( 0.5f, -0.5f, 0.5f ),
    D3DXVECTOR3( -0.5f, -0.5f, 0.5f ),
};

below is the code in it's entirety. Cant figure out whats wrong. thanks

// include the basic windows header file
#include "D3Dapp.h"


class MyGame: public D3Dapp
{
    public:
        bool Init3d();
};
MyGame game;
// Create vertex buffer
SimpleVertex vertices[] =
{
    D3DXVECTOR3( 0.0f, 0.5f, 0.5f ),
    D3DXVECTOR3( 0.5f, -0.5f, 0.5f ),
    D3DXVECTOR3( -0.5f, -0.5f, 0.5f ),
};


// the entry point for any Windows program
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{
     game.InitWindow(hInstance , nCmdShow);
     return game.Run();
}


bool MyGame::Init3d()
{
    D3Dapp::Init3d();

    return true;
}

© Stack Overflow or respective owner

Related posts about c++

Related posts about directx