Error problem
Alert me | Edit | Delete | Change type Question You cannot vote on your own post 0 I had setup the pch.h script to work with all other scripts #pragma once #include <wrl.h> #include <wrl/client.h> #include <dxgi1_4.h> #include <d3d11_3.h> #include <d2d1_3.h> #include <d2d1effects_2.h> #include <dwrite_3.h> #include <wincodec.h> #include <DirectXColors.h> #include <DirectXMath.h> #include <memory> #include <agile.h> #include <concrt.h> //Include and link appropriate libraries and headers// #pragma comment(lib, "d3d11.lib") #pragma comment(lib, "d3dx11.lib") #pragma comment(lib, "d3dx10.lib") #pragma comment (lib, "D3D10_1.lib") #pragma comment (lib, "DXGI.lib") #pragma comment (lib, "D2D1.lib") #pragma comment (lib, "dwrite.lib") #pragma comment (lib, "dinput8.lib") #pragma comment (lib, "dxguid.lib") #pragma comment (lib, "DXErr.lib") #include <windows.h> #include <d3d11.h> #include <D3D10_1.h> #include <DXGI.h> #include <D2D1.h> #include <sstream> #include <dwrite.h> ///////////////**************new**************//////////////////// #include <vector> #include <fstream> #include <istream> ///////////////**************new**************//////////////////// using namespace DirectX; using namespace Moga::Windows::Phone; struct Vertex //Overloaded Vertex Structure { Vertex() {} Vertex(float x, float y, float z, float u, float v, float nx, float ny, float nz, float tx, float ty, float tz) : pos(x, y, z), texCoord(u, v), normal(nx, ny, nz), tangent(tx, ty, tz) {} XMFLOAT3 pos; XMFLOAT2 texCoord; XMFLOAT3 normal; XMFLOAT3 tangent; XMFLOAT3 biTangent; ///////////////**************new**************//////////////////// // Will not be sent to shader int StartWeight; int WeightCount; ///////////////**************new**************//////////////////// }; //Global Declarations - Interfaces// IDXGISwapChain* SwapChain; ID3D11Device* d3d11Device; ID3D11DeviceContext* d3d11DevCon; ID3D11RenderTargetView* renderTargetView; ID3D11DepthStencilView* depthStencilView; ID3D11Texture2D* depthStencilBuffer; ID3D11VertexShader* VS; ID3D11PixelShader* PS; ID3D11PixelShader* D2D_PS; ID3D10Blob* D2D_PS_Buffer; ID3D10Blob* VS_Buffer; ID3D10Blob* PS_Buffer; ID3D11InputLayout* vertLayout; ID3D11Buffer* cbPerObjectBuffer; ID3D11BlendState* d2dTransparency; ID3D11RasterizerState* CCWcullMode; ID3D11RasterizerState* CWcullMode; ID3D11SamplerState* CubesTexSamplerState; ID3D11Buffer* cbPerFrameBuffer; ID3D10Device1 *d3d101Device; IDXGIKeyedMutex *keyedMutex11; IDXGIKeyedMutex *keyedMutex10; ID2D1RenderTarget *D2DRenderTarget; ID2D1SolidColorBrush *Brush; ID3D11Texture2D *BackBuffer11; ID3D11Texture2D *sharedTex11; ID3D11Buffer *d2dVertBuffer; ID3D11Buffer *d2dIndexBuffer; ID3D11ShaderResourceView *d2dTexture; IDWriteFactory *DWriteFactory; IDWriteTextFormat *TextFormat; ID3D11BlendState* Transparency; ID3D11Buffer* sphereIndexBuffer; ID3D11Buffer* sphereVertBuffer; ID3D11VertexShader* SKYMAP_VS; ID3D11PixelShader* SKYMAP_PS; ID3D10Blob* SKYMAP_VS_Buffer; ID3D10Blob* SKYMAP_PS_Buffer; ID3D11ShaderResourceView* smrv; ID3D11DepthStencilState* DSLessEqual; ID3D11RasterizerState* RSCullNone; int NumSphereVertices; int NumSphereFaces; XMMATRIX sphereArena; ID3D11Buffer* meshVertBuff; ID3D11Buffer* meshIndexBuff; XMMATRIX meshWorld; int meshSubsets = 0; std::vector<int> meshSubsetIndexStart; std::vector<int> meshSubsetTexture; std::vector<ID3D11ShaderResourceView*> meshSRV; std::vector<std::wstring> textureNameArray; UINT stride = sizeof(Vertex); UINT offset = 0; //Create effects constant buffer's structure// struct cbPerObject { XMMATRIX WVP; XMMATRIX World; //These will be used for the pixel shader XMFLOAT4 difColor; BOOL hasTexture; //Because of HLSL structure packing, we will use windows BOOL //instead of bool because HLSL packs things into 4 bytes, and //bool is only one byte, where BOOL is 4 bytes BOOL hasNormMap; }; cbPerObject cbPerObj; XMMATRIX Rotation; XMMATRIX Scale; XMMATRIX Translation; struct SurfaceMaterial { std::wstring matName; XMFLOAT4 difColor; int texArrayIndex; bool hasTexture; bool transparent; }; std::vector<SurfaceMaterial> material; XMVECTOR currPlayerDirection = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); XMVECTOR oldPlayerDirection = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); XMVECTOR playerPosition = XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f); XMMATRIX Rotationx; XMMATRIX Rotationz; XMMATRIX Rotationy; // Vectors XMVECTOR camPosition; XMVECTOR camTarget; XMVECTOR camUp; XMMATRIX WVP; XMMATRIX camView; XMMATRIX camProjection; XMVECTOR DefaultForward = XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f); XMVECTOR DefaultRight = XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f); XMVECTOR camForward = XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f); XMVECTOR camRight = XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f); XMMATRIX camRotationMatrix; XMMATRIX groundArena; float moveLeftRight = 0.0f; float moveBackForward = 0.0f; float camYaw = 0.0f; float camPitch = 0.0f; XMVECTOR racquetBoundingBoxMinVertex[820]; XMVECTOR racquetBoundingBoxMaxVertex[820]; XMVECTOR ballBoundingBoxMinVertex; XMVECTOR ballBoundingBoundingBoxMaxVertex; XMMATRIX ballBoundingArena; XMVECTOR ballBoundingDir; float playerCamDist = 15.0f; struct Joint { std::wstring name; int parentID; XMFLOAT3 pos; XMFLOAT4 orientation; }; D3D11_INPUT_ELEMENT_DESC layout[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; UINT numElements = ARRAYSIZE(layout); struct Weight { int jointID; float bias; XMFLOAT3 pos; XMFLOAT3 normal; }; struct ModelSubset { int texArrayIndex; int numTriangles; std::vector<Vertex> vertices; std::vector<DWORD> indices; std::vector<Weight> weights; std::vector<XMFLOAT3> positions; ID3D11Buffer* vertBuff; ID3D11Buffer* indexBuff; }; struct Model3D { int numSubsets; int numJoints; std::vector<Joint> joints; std::vector<ModelSubset> subsets; std::vector<ModelAnimation> animations; }; struct BoundingBox { XMFLOAT3 min; XMFLOAT3 max; }; struct FrameData { int frameID; std::vector<float> frameData; }; struct AnimJointInfo { std::wstring name; int parentID; int flags; int startIndex; }; struct ModelAnimation { int numFrames; int numJoints; int frameRate; int numAnimatedComponents; float frameTime; float totalAnimTime; float currAnimTime; std::vector<AnimJointInfo> jointInfo; std::vector<BoundingBox> frameBounds; std::vector<Joint> baseFrameJoints; std::vector<FrameData> frameData; std::vector<std::vector<Joint>> frameSkeleton; }; float red = 0.0f; float green = 0.0f; float blue = 0.0f; int colormodr = 1; int colormodg = 1; int colormodb = 1; DXGI_SWAP_CHAIN_DESC swapChainDesc; //Global Declarations - Others// LPCTSTR WndClassName = L"firstwindow"; HWND hwnd = NULL; HRESULT hr; int Width = 1920; int Height = 1200; typedef struct DXGI_MODE_DESC { UINT Width; UINT Height; DXGI_RATIONAL RefreshRate; DXGI_FORMAT Format; DXGI_MODE_SCANLINE_ORDER ScanlineOrdering; DXGI_MODE_SCALING Scaling; } DXGI_MODE_DESC, *LPDXGI_MODE_DESC; HRESULT D3D11CreateDeviceAndSwapChain( __in IDXGIAdapter *pAdapter, __in D3D_DRIVER_TYPE DriverType, __in HMODULE Software, __in UINT Flags, __in const D3D_FEATURE_LEVEL *pFeatureLevels, __in UINT FeatureLevels, __in UINT SDKVersion, __in const DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, __out IDXGISwapChain **ppSwapChain, __out ID3D11Device **ppDevice, __out D3D_FEATURE_LEVEL *pFeatureLevel, __out ID3D11DeviceContext **ppImmediateContext ); I keep getting these errors Description Project File Line Suppression State Error C2923 'std::vector': 'ModelAnimation' is not a valid template type argument for parameter '_Ty' OpenServe c:usersgarredocumentsvisual studio 2017projectsopenserveopenservepch.h 259 Error C3203 'allocator': unspecialized class template can't be used as a template argument for template parameter '_Alloc', expected a real type OpenServe c:usersgarredocumentsvisual studio 2017projectsopenserveopenservepch.h 259 Error C2011 'DXGI_MODE_DESC': 'struct' type redefinition OpenServe c:usersgarredocumentsvisual studio 2017projectsopenserveopenservepch.h 319 Error C2065 'ModelAnimation': undeclared identifier OpenServe c:usersgarredocumentsvisual studio 2017projectsopenserveopenservepch.h 259 Is there any way I can get it to work without the errors
Sign in to comment
the struct ModelAnimation needs to be declared before you use it. in your code you have: std::vector<ModelAnimation> animations; before you declare: struct ModelAnimation { ... } finally, remove: typedef struct DXGI_MODE_DESC { UINT Width; UINT Height; DXGI_RATIONAL RefreshRate; DXGI_FORMAT Format; DXGI_MODE_SCANLINE_ORDER ScanlineOrdering; DXGI_MODE_SCALING Scaling; } DXGI_MODE_DESC, *LPDXGI_MODE_DESC; as it is already defined in the dxgi headers