Vertex Buffers? (EDIT: SOLVED) (Direct3D)

Started by
13 comments, last by dist0rted 17 years, 9 months ago
Alrighty, I'll keep messing around, but here's the complete list of errors:

1>------ Build started: Project: DGLIB, Configuration: Debug Win32 ------1>Compiling...1>CDGApplication.cpp1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.h(6) : error C2236: unexpected 'class' 'CDGApplication'. Did you forget a ';'?1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.h(6) : error C2143: syntax error : missing ';' before '{'1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.h(6) : error C2447: '{' : missing function header (old-style formal list?)1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(3) : error C2653: 'CDGApplication' : is not a class or namespace name1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(4) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(5) : error C2065: 'm_hInstance' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(6) : error C2065: 'm_hWnd' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(7) : error C2065: 'm_Msg' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(7) : error C2070: ''unknown-type'': illegal sizeof operand1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(8) : error C2065: 'm_WndClass' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(8) : error C2070: ''unknown-type'': illegal sizeof operand1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(10) : error C2065: 'm_pszAppTitle' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(11) : error C2065: 'm_nWidth' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(12) : error C2065: 'm_nHeight' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(13) : error C2065: 'm_bWindowed' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(15) : error C2065: 'm_pD3D' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(16) : error C2065: 'm_pd3dDevice' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(17) : warning C4508: 'CDGApplication' : function should return a value; 'void' return type assumed1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(19) : error C2653: 'CDGApplication' : is not a class or namespace name1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(43) : error C2653: 'CDGApplication' : is not a class or namespace name1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(54) : error C2228: left of '.cbClsExtra' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(55) : error C2228: left of '.cbSize' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(56) : error C2228: left of '.cbWndExtra' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(57) : error C2228: left of '.hbrBackground' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(58) : error C2228: left of '.hCursor' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(59) : error C2228: left of '.hIcon' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(60) : error C2228: left of '.hIconSm' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(61) : error C2228: left of '.hInstance' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(62) : error C2228: left of '.lpfnWndProc' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(63) : error C2228: left of '.lpszClassName' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(64) : error C2228: left of '.lpszMenuName' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(65) : error C2228: left of '.style' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(107) : error C2227: left of '->GetAdapterDisplayMode' must point to class/struct/union/generic type1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(113) : error C2227: left of '->GetDeviceCaps' must point to class/struct/union/generic type1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(142) : error C2065: 'm_PresentParameters' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(142) : error C2070: ''unknown-type'': illegal sizeof operand1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(153) : error C2227: left of '->CheckDeviceFormat' must point to class/struct/union/generic type1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(155) : error C2228: left of '.AutoDepthStencilFormat' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(162) : error C2227: left of '->CheckDeviceFormat' must point to class/struct/union/generic type1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(164) : error C2228: left of '.AutoDepthStencilFormat' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(171) : error C2227: left of '->CheckDeviceFormat' must point to class/struct/union/generic type1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(173) : error C2228: left of '.AutoDepthStencilFormat' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(180) : error C2228: left of '.BackBufferCount' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(181) : error C2228: left of '.BackBufferFormat' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(182) : error C2228: left of '.BackBufferWidth' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(183) : error C2228: left of '.BackBufferHeight' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(184) : error C2228: left of '.EnableAutoDepthStencil' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(185) : error C2228: left of '.FullScreen_RefreshRateInHz' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(186) : error C2228: left of '.hDeviceWindow' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(187) : error C2228: left of '.MultiSampleQuality' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(188) : error C2228: left of '.MultiSampleType' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(189) : error C2228: left of '.PresentationInterval' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(190) : error C2228: left of '.SwapEffect' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(191) : error C2228: left of '.Windowed' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(194) : error C2227: left of '->CreateDevice' must point to class/struct/union/generic type1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(203) : error C3861: 'OneTimeSceneInit': identifier not found1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(208) : error C3861: 'InitDeviceObjects': identifier not found1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(213) : error C3861: 'RestoreDeviceObjects': identifier not found1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(221) : error C2653: 'CDGApplication' : is not a class or namespace name1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(224) : error C2070: ''unknown-type'': illegal sizeof operand1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(226) : error C2228: left of '.message' must have class/struct/union1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.cpp(226) : fatal error C1903: unable to recover from previous error(s); stopping compilation1>Main.cpp1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.h(6) : error C2236: unexpected 'class' 'CDGApplication'. Did you forget a ';'?1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.h(6) : error C2143: syntax error : missing ';' before '{'1>d:\my documents\visual studio 2005\projects\dglib\cdgapplication.h(6) : error C2447: '{' : missing function header (old-style formal list?)1>d:\my documents\visual studio 2005\projects\dglib\main.cpp(6) : error C2504: 'CDGApplication' : base class undefined1>d:\my documents\visual studio 2005\projects\dglib\main.cpp(19) : error C2065: 'm_pd3dDevice' : undeclared identifier1>d:\my documents\visual studio 2005\projects\dglib\main.cpp(19) : error C2227: left of '->SetTransform' must point to class/struct/union/generic type1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\main.cpp(20) : error C2227: left of '->SetTransform' must point to class/struct/union/generic type1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\main.cpp(23) : error C2227: left of '->SetTransform' must point to class/struct/union/generic type1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\main.cpp(25) : error C2227: left of '->SetRenderState' must point to class/struct/union/generic type1>        type is ''unknown-type''1>d:\my documents\visual studio 2005\projects\dglib\main.cpp(44) : error C2039: 'Init' : is not a member of 'CMyDGApplication'1>        d:\my documents\visual studio 2005\projects\dglib\main.cpp(5) : see declaration of 'CMyDGApplication'1>d:\my documents\visual studio 2005\projects\dglib\main.cpp(46) : error C2039: 'EventLoop' : is not a member of 'CMyDGApplication'1>        d:\my documents\visual studio 2005\projects\dglib\main.cpp(5) : see declaration of 'CMyDGApplication'1>d:\my documents\visual studio 2005\projects\dglib\main.cpp(49) : error C2039: 'Shutdown' : is not a member of 'CMyDGApplication'1>        d:\my documents\visual studio 2005\projects\dglib\main.cpp(5) : see declaration of 'CMyDGApplication'1>Generating Code...1>Build log was saved at "file://d:\My Documents\Visual Studio 2005\Projects\DGLIB\Debug\BuildLog.htm"1>DGLIB - 73 error(s), 1 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
=============================All knowledge is good; only the way it is put to use is good or evil.
Advertisement
Please show dgproject.h.
NOTE: If I rearrange which order I include CDGApplication.h/CDGVertexBuffer.h/CDGIndexBuffer.h, the error output will be different (the errors will come from a different header file). The errors I posted earlier were from when I just included CDGApplication.h and neither of the other two.

EDIT: Just as an explanation, I don't use "#pragma once" because this file is included in just about every file in the project, and doing so will create errors. (And since there's no definitions like functions or classes that will create linker errors, it's no problem.)

dgproject.h:
/*dgproject.h : Distorted Graphics Library main header file*/// link w/ D3D and more!#pragma comment(lib, "d3d9.lib") // Direct3D 9#pragma comment(lib, "d3dx9.lib") // D3D X Library#pragma comment(lib, "dxguid.lib") // DirectX GUI definition#pragma comment(lib, "winmm.lib") // Windows MultiMedia Library#include <d3d9.h> // Direct3D 9#include <d3dx9.h> // D3D X Library#include <stdio.h> // C Standard I/O#include <string.h> // C Strings#include <time.h> // For Time Functions#include <windows.h> // Windows API#include "dgdatatypes.h" // Data Types#include "dgerror.h" // DGRESULT definitions#include "CDGApplication.h" // class CDGApplication#include "CDGIndexBuffer.h" // class CDGIndexBuffer#include "CDGVertex.h" // class CDGVertex#include "CDGVertexBuffer.h" // class CDGVertexBuffer#define DGRELEASE(DXObject) { if (DXObject) { DXObject->Release(); DXObject = NULL; } } // Release a DX Object
=============================All knowledge is good; only the way it is put to use is good or evil.
This might not be the source of your problems, but it's well worth noting anyway:

I assume your CDGApplication.cpp file is including CDGApplication.h.
Your CDGApplication.h file includes dgproject.h. But your dgproject.h file is including CDGApplication.h right back! So CDGApplication.h includes dgproject.h which includes CDGApplication.h which includes dgproject.h which includes CDGApplication.h which includes dgproject.h which includes CDGApplication.h which includes dgproject.h which includes CDGApplication.h [...]

I'm not sure if this alone is responsible for causing the problems. In any case, for this reason, having a central header file which includes everything else is a dangerous idea.

I suggest you try commenting out each #include statement one by one and recompiling your project. If the only errors your compiler generates are the ones you would expect due to missing definitions, then whichever header file you commented out could be the culprit. And if switching the order of your includes changes the errors your compiler generates, you could be 95% sure that the problem is within one of your header files.
.:<<-v0d[KA]->>:.
I'll try, and will edit this post with the result, but please remember: I created the entire project this way - it's been working until I created these two new classes. Before that, it compiled just fine and rendered my Direct3D graphics that I'd been doing with DrawPrimitiveUP(). (Also, I have #pragma once to prevent that from happeneing.)

EDIT: Alrighty, the results were quite interesting... I removed the class header files (CDGblahblah.h) from project.h, and just included CDGApplication in my main file... it compiled fine... then I included CDGVertexBuffer/CDGIndexBuffer (and didn't even use the classes in them)... it had compiler errors where I defined a class in WinMain.cpp...

SO! I'm going to host my project files at my web site, to which I will soon edit and put a link on this post.

EDIT: http://www.bulldawggames.com/gamedev/ (It compiles fine, UNLESS I try to include the CDGVertexBuffer.h/CDGIndexBuffer.h files in WinMain.cpp, and I will need to use them!!!)

EDIT (AGAIN!): SOLVED!!!! THANKS to you vodka!

[Edited by - dist0rted on July 22, 2006 12:08:47 PM]
=============================All knowledge is good; only the way it is put to use is good or evil.

This topic is closed to new replies.

Advertisement