Original Post
I am getting some weird errors from the following code: The errors I am getting are: C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(48) : error C2466: cannot allocate an array of constant size 0 C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(48) : error C2501: 'vertices' : missing storage-class or type specifiers C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(48) : error C2371: 'vertices' : redefinition; different basic types C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(46) : see declaration of 'vertices' C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(48) : error C2440: 'initializing' : cannot convert from 'struct CUSTOMVERTEX' to 'int []' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(49) : error C2501: 'vertices' : missing storage-class or type specifiers C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(49) : error C2369: 'vertices' : redefinition; different subscripts C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(46) : see declaration of 'vertices' C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(49) : error C2440: 'initializing' : cannot convert from 'struct CUSTOMVERTEX' to 'int [1]' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(50) : error C2501: 'vertices' : missing storage-class or type specifiers C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(50) : error C2369: 'vertices' : redefinition; different subscripts C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(46) : see declaration of 'vertices' C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(50) : error C2440: 'initializing' : cannot convert from 'struct CUSTOMVERTEX' to 'int [2]' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(51) : error C2501: 'vertices' : missing storage-class or type specifiers C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(51) : error C2369: 'vertices' : redefinition; different subscripts C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(46) : see declaration of 'vertices' C:\Kool\Game Dev\D3DDemo\d3ddemo.cpp(51) : error C2440: 'initializing' : cannot convert from 'struct CUSTOMVERTEX' to 'int [3]' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called Any ideas what is going on?
//CODE I AM GETTING ERRORS FROM
CUSTOMVERTEX vertices[4];
vertices[0] = CreateVertex(150.0f, 50.0f, 0.5f, 0, 0);
vertices[1] = CreateVertex(250.0f, 50.0f, 0.5f, 1, 0);
vertices[2] = CreateVertex(250.0f, 150.0f, 0.5f, 1, 1);
vertices[3] = CreateVertex(150.0f, 150.0f, 0.5f, 0, 1);
//HEADER FILE CONTAINING CreateVertex method
/**
*D3DUtils.h
*Contains utility methods for D3D.
*Author: Kane McGovern
*Revision: 25 November 2004
*/
#ifndef D3DUtils
#define D3DUtils
//CUSTOM VERTEX//////////////////////
struct CUSTOMVERTEX
{
float x, y, z;
float tu, tv;
}; //close CUSTOMVERTEX struct
CUSTOMVERTEX CreateVertex(float newX, float newY, float newZ, float newTu, float newTv)
{
CUSTOMVERTEX vertex;
vertex.x = newX;
vertex.y = newY;
vertex.z = newZ;
vertex.tu = newTu;
vertex.tv = newTv;
return vertex;
} //close CreateVertex method
#endif