Je chercherais habituellement cette erreur. Mais dans VS C++ Express, cette erreur survient pour à peu près toutes les erreurs que vous faites. Tout ce que je reçois cette erreur ci-dessouserreur C2146: erreur de syntaxe: manquant ';' before identifier 'verteices'
error C2146: syntax error : missing ';' before identifier 'vertices'
chaque fois que j'ajouter le code suivant en haut de mon 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),
};
ci-dessous est le code dans son intégralité. Je n'arrive pas à comprendre ce qui ne va pas. grâce
[EDIT]
// include the basic windows header file
#include "D3Dapp.h"
class MyGame: public D3Dapp
{
public:
bool Init3d();
};
MyGame game;
struct SimpleVertex
{
D3DXVECTOR3 Pos; // Position
};
// 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();
// 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),
}
return true;
}
nouvelle erreur
1>c:\users\numerical25\desktop\intro todirectx\msdntutorials\tutorial0\tutorial\tutorial\main.cpp(14) : error C2146: syntax error : missing ';' before identifier 'Pos'
La classe 'SimpleVertex' est-elle définie dans' D3Dapp.h'? –
Non, ce n'est pas le cas, la première apparition de SimpleVertex est l'endroit où vous le voyez maintenant. – numerical25
J'ai modifié le code. Voir en haut – numerical25