Skip to main content
gamedev.net
🔒 Locked

Please Help

Started by Cinshe Jul 13, 2006 at 7:02 PM 4 replies 850+ views
Original Post
Cinshe
Cinshe
Hello, i am new to C++, and bought the book "Programming Role Playing Games with Directx" by Jim Adams. for some reason none of the code works on my compiler. I was hoping that some one in this sight could help me. the code that i transfered straight from the book went like this... idirect3d9 *direct3dcreate9( uint sdkversion); //d3d_sdk_version idirect3d9 g_d3d // global idirect3d9 object if ((g_d3d= direct3dcreate9(d3d_sdk_version))==null){ //error occurred } typedef struct _d3ddisplaymode { uint width; //screen width in pixels uint height; //screen heigth in pixels uint refreshrate; //refresh rate (0=default) d3dformat format; //color format } d3ddisplaymode; d3ddisplaymode d3ddm; d3ddm.width=640; d3ddm.height=480; d3ddm.refreshrate=0; //use default d3ddm.format=d3dfmt_r5g6b5; //g_pd3d=pre-initialized direct3d object //d3df=pre-initialized d3dformat structure // check if display mode exists if (failed(g_pd3d->checkdevicetype(d3dadapter_default, d3ddevtype_hal, &d3df, &d3df, false))){ //error occurred-color mode not supported } typedef struct _d3dpresent_parameters { uint dackbufferwidth; //width of backbuffer uint backbufferheigth; //heigth of backbuffer d3dformat backbufferformat; //same as display mode format uint backbuffercount; //1 d3dmultisample_type multisampletype; //0 d3dswapeffect swapeffect; //how to display backbuffer hwnd hndevicewindow; //null dool windowed; //true for windowed mode //false for fullscreen mode bool enableautodepthstencil; //false d3dformat autodepthstencilformat; //0 dword flags; //0 uint fullscreen_refreshrateinhz; //0 uint presentationinterval; //0 } d3dpresent_parameters; //d3ddm=pre-initialized d3ddisplaymode structure d3dpresent_parameters d3dpp; //clear out the structure zeromemory(&d3dpp, sizeof(d3dpresent_parameters)); dedpp.swapeffect=d3dswapeffect_discard; d3dpp.backbufferformat=d3ddm.format; //use same color mode //for fullscreen mode, use; d3dpp.windowed=false; d3dpp.swapeffect=d3dswapeffect_flip; d3dpp.fullscreen_refreshrateinhz=d3dpresent_internal_default; d3dpp.presentationinterval=d3dpresent_interval_default; d3dpp.backbufferformat=d3ddm.format; //use same color mode //for both windowed and fullscreen, specify the width and heigth d3dpp.backbufferwidth=1000; //supply your own width d3dpp.backbufferheight=1000; //supply your own heigth this gave me these errors... ------ Build started: Project: Game, Configuration: Debug Win32 ------ Compiling... Game.cpp g:\programing\myprograms\game\game\Game.h(6) : error C2143: syntax error : missing ';' before '*' g:\programing\myprograms\game\game\Game.h(6) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(7) : error C2061: syntax error : identifier 'uint' g:\programing\myprograms\game\game\Game.h(7) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(7) : warning C4183: 'direct3dcreate9': missing return type; assumed to be a member function returning 'int' g:\programing\myprograms\game\game\Game.h(9) : error C2146: syntax error : missing ';' before identifier 'g_d3d' g:\programing\myprograms\game\game\Game.h(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(9) : error C2143: syntax error : missing ';' before 'if' g:\programing\myprograms\game\game\Game.h(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(9) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body g:\programing\myprograms\game\game\Game.h(13) : error C2146: syntax error : missing ';' before identifier 'width' g:\programing\myprograms\game\game\Game.h(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(14) : error C2146: syntax error : missing ';' before identifier 'height' g:\programing\myprograms\game\game\Game.h(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(15) : error C2146: syntax error : missing ';' before identifier 'refreshrate' g:\programing\myprograms\game\game\Game.h(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(16) : error C2146: syntax error : missing ';' before identifier 'format' g:\programing\myprograms\game\game\Game.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(20) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(20) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(21) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(21) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(21) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(22) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(22) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(22) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(23) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(23) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(28) : error C2059: syntax error : 'if' g:\programing\myprograms\game\game\Game.h(29) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body g:\programing\myprograms\game\game\Game.h(35) : error C2146: syntax error : missing ';' before identifier 'dackbufferwidth' g:\programing\myprograms\game\game\Game.h(35) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(35) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(36) : error C2146: syntax error : missing ';' before identifier 'backbufferheigth' g:\programing\myprograms\game\game\Game.h(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(37) : error C2146: syntax error : missing ';' before identifier 'backbufferformat' g:\programing\myprograms\game\game\Game.h(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(38) : error C2146: syntax error : missing ';' before identifier 'backbuffercount' g:\programing\myprograms\game\game\Game.h(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(40) : error C2146: syntax error : missing ';' before identifier 'multisampletype' g:\programing\myprograms\game\game\Game.h(40) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(40) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(41) : error C2146: syntax error : missing ';' before identifier 'swapeffect' g:\programing\myprograms\game\game\Game.h(41) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(41) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(43) : error C2146: syntax error : missing ';' before identifier 'hndevicewindow' g:\programing\myprograms\game\game\Game.h(43) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(43) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(44) : error C2146: syntax error : missing ';' before identifier 'windowed' g:\programing\myprograms\game\game\Game.h(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(46) : error C2146: syntax error : missing ';' before identifier 'autodepthstencilformat' g:\programing\myprograms\game\game\Game.h(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(48) : error C2146: syntax error : missing ';' before identifier 'flags' g:\programing\myprograms\game\game\Game.h(48) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(48) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(50) : error C2146: syntax error : missing ';' before identifier 'fullscreen_refreshrateinhz' g:\programing\myprograms\game\game\Game.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(51) : error C2146: syntax error : missing ';' before identifier 'presentationinterval' g:\programing\myprograms\game\game\Game.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(56) : error C2146: syntax error : missing ';' before identifier 'd3dpresent_parameters' g:\programing\myprograms\game\game\Game.h(59) : error C2059: syntax error : '&' g:\programing\myprograms\game\game\Game.h(60) : error C2059: syntax error : ')' g:\programing\myprograms\game\game\Game.h(60) : error C2143: syntax error : missing ')' before ';' g:\programing\myprograms\game\game\Game.h(60) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(60) : warning C4183: 'zeromemory': missing return type; assumed to be a member function returning 'int' g:\programing\myprograms\game\game\Game.h(62) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(62) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(62) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(63) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(63) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(63) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(66) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(66) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(67) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(67) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(68) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(68) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(69) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(69) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(69) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(70) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(70) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(73) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(73) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(73) : error C2238: unexpected token(s) preceding ';' g:\programing\myprograms\game\game\Game.h(74) : error C2143: syntax error : missing ';' before '.' g:\programing\myprograms\game\game\Game.h(74) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int g:\programing\myprograms\game\game\Game.h(74) : error C2238: unexpected token(s) preceding ';' .\Game.cpp(2) : error C2143: syntax error : missing ';' before '*' .\Game.cpp(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(3) : error C2065: 'uint' : undeclared identifier .\Game.cpp(3) : error C2146: syntax error : missing ')' before identifier 'sdkversion' .\Game.cpp(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(3) : error C2059: syntax error : ')' .\Game.cpp(5) : error C2146: syntax error : missing ';' before identifier 'g_d3d' .\Game.cpp(5) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(5) : error C2086: 'int idirect3d9' : redefinition .\Game.cpp(2) : see declaration of 'idirect3d9' .\Game.cpp(5) : error C2143: syntax error : missing ';' before 'if' .\Game.cpp(5) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(5) : error C2143: syntax error : missing ';' before '{' .\Game.cpp(5) : error C2447: '{' : missing function header (old-style formal list?) .\Game.cpp(9) : error C2146: syntax error : missing ';' before identifier 'width' .\Game.cpp(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(10) : error C2146: syntax error : missing ';' before identifier 'height' .\Game.cpp(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(11) : error C2146: syntax error : missing ';' before identifier 'refreshrate' .\Game.cpp(11) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(11) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(12) : error C2146: syntax error : missing ';' before identifier 'format' .\Game.cpp(12) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(12) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(16) : error C2143: syntax error : missing ';' before '.' .\Game.cpp(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(16) : error C2371: 'd3ddm' : redefinition; different basic types .\Game.cpp(15) : see declaration of 'd3ddm' .\Game.cpp(17) : error C2143: syntax error : missing ';' before '.' .\Game.cpp(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(17) : error C2371: 'd3ddm' : redefinition; different basic types .\Game.cpp(15) : see declaration of 'd3ddm' .\Game.cpp(18) : error C2143: syntax error : missing ';' before '.' .\Game.cpp(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(18) : error C2371: 'd3ddm' : redefinition; different basic types .\Game.cpp(15) : see declaration of 'd3ddm' .\Game.cpp(19) : error C2143: syntax error : missing ';' before '.' .\Game.cpp(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(19) : error C2371: 'd3ddm' : redefinition; different basic types .\Game.cpp(15) : see declaration of 'd3ddm' .\Game.cpp(24) : error C2059: syntax error : 'if' .\Game.cpp(25) : error C2143: syntax error : missing ';' before '{' .\Game.cpp(25) : error C2447: '{' : missing function header (old-style formal list?) .\Game.cpp(31) : error C2146: syntax error : missing ';' before identifier 'dackbufferwidth' .\Game.cpp(31) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(31) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(32) : error C2146: syntax error : missing ';' before identifier 'backbufferheigth' .\Game.cpp(32) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(32) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(33) : error C2146: syntax error : missing ';' before identifier 'backbufferformat' .\Game.cpp(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(34) : error C2146: syntax error : missing ';' before identifier 'backbuffercount' .\Game.cpp(34) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(34) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(36) : error C2146: syntax error : missing ';' before identifier 'multisampletype' .\Game.cpp(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(37) : error C2146: syntax error : missing ';' before identifier 'swapeffect' .\Game.cpp(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(39) : error C2146: syntax error : missing ';' before identifier 'hndevicewindow' .\Game.cpp(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(40) : error C2146: syntax error : missing ';' before identifier 'windowed' .\Game.cpp(40) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(40) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(42) : error C2146: syntax error : missing ';' before identifier 'autodepthstencilformat' .\Game.cpp(42) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(42) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(44) : error C2146: syntax error : missing ';' before identifier 'flags' .\Game.cpp(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(46) : error C2146: syntax error : missing ';' before identifier 'fullscreen_refreshrateinhz' .\Game.cpp(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(47) : error C2146: syntax error : missing ';' before identifier 'presentationinterval' .\Game.cpp(47) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(47) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(52) : error C2146: syntax error : missing ';' before identifier 'd3dpresent_parameters' .\Game.cpp(56) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(56) : error C2078: too many initializers .\Game.cpp(58) : error C2143: syntax error : missing ';' before '.' .\Game.cpp(58) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(59) : error C2143: syntax error : missing ';' before '.' .\Game.cpp(59) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(59) : error C2371: 'd3dpp' : redefinition; different basic types .\Game.cpp(52) : see declaration of 'd3dpp' .\Game.cpp(62) : error C2143: syntax error : missing ';' before '.' .\Game.cpp(62) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(62) : error C2371: 'd3dpp' : redefinition; different basic types .\Game.cpp(52) : see declaration of 'd3dpp' .\Game.cpp(63) : error C2143: syntax error : missing ';' before '.' .\Game.cpp(63) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(63) : error C2371: 'd3dpp' : redefinition; different basic types .\Game.cpp(52) : see declaration of 'd3dpp' .\Game.cpp(64) : error C2143: syntax error : missing ';' before '.' .\Game.cpp(64) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int .\Game.cpp(64) : error C2371: 'd3dpp' : redefinition; different basic types .\Game.cpp(52) : see declaration of 'd3dpp' .\Game.cpp(65) : error C2143: syntax error : missing ';' before '.' .\Game.cpp(65) : fatal error C1003: error count exceeds 100; stopping compilation Build log was saved at "file://g:\Programing\MyPrograms\Game\Game\Debug\BuildLog.htm" Game - 198 error(s), 2 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Thank you for any and all help recieved.
nobodynews
nobodynews
If that was really all the code that you typed in then my guess is he didn't write the code for the entire program, just a segment of it. A lot of books do this to save space. Rather than printing the code for every program in entirety they just print the new stuff, explain it, and give you a CD with the full code on it. So if that book came with a CD, try looking through it for the full code listing.

Oh, one more thing. Don't ever, ever, ever again just copy and paste the code unless you enclose the code in source tags. That is before the code write [ source] without the space and after the code write [ /source] also without the space. Then you'll get this:
CODE HERE!

Hope that helps.
C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) ,
Peachy keen
Peachy keen
Oh jeeze thats a lot of errors!

OOOOkay, for starters, DirectX [and thus of course D3D] is very picky about case, and capitalizes a whole bunch of stuff. For example, it's IDirect3D9 instead of idirect3d9... everywhere. It's Direct3DCreate9, for the function header. There is actually a bunch of stuff like that in here, including D3DFORMAT as opposed to d3dformat. It's stuff like this that is causing you to have all these unrecognized tokens, and thus is throwing a huge number of the other errors... Oh, and it's UINT, instead of uint.

There might be more errors, actually meaningful errors, but the case-sensitive stuff is definately making them a whole lot harder to find :P

You might want to bring up your SDK, and just type each of the d3d things into the index, so that it can give you the correct case [which in general is pretty consistant, all caps for structure names, capitalization of first words or 3D's in function names, all caps for defines, ect...], or just copy and paste from the actual code file that came with the cd, as opposed to typing it out yourself [if they shipped the book with this code on the cd....then never buy from this author/publisher ever again]


... wow thats a lot of errors
nobodynews
nobodynews
Yeah, what he said about typing stuff in upper-case if it appears that way in the book as well, I didn't really pay attention to that, but that's another source of problems.

It's a little worrying that everything is in lower case. That's one of the first things you learn about when studying programming in C and C++. If you haven't learned C++ or in this case C (I think that book is using C) then I also recommend you forget about DirectX for awhile and actually learn the language first.

My appologies if I'm mistaken and you are experienced.
C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) ,
Peachy keen
Peachy keen
Not that it makes any difference, but the book is certainly using C++ specific things, but it's treating it like C, and coding in a C-like way.
Cinshe
Cinshe
Sorry, i was chatting with some one and he just told me to post the whole thing. i did not know that i needed some source thing.

No, i am no beginner in programming. I am entirely new to C and C++ though. The book did come with a CD with source, and it said it is for beginners and for intermediate. I use VB, where for the most part it would automatically capitalize things for you that needed to be capitalized, so i didn't think much of it. Thanks for telling me that the program is case sensative, I'll try it out again and see if that helps.

Also, though right now i can't figure out where, but i think he does mention using the two together. I could be wrong though.

Just testing to make sure for next time.]/source]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.