• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Rudra

DX11
[C++] Linking libraries and outdated VS-VC++

7 posts in this topic

Okay so here is my dilemma. I have purchased "Beginning game Programming 3rd ed" by Jonathan S. Harbour. The book uses the Xp OS and DX9, and VC++. Im using a Win 7 and DX11 with VC++ Express edition.

I discovered that VC++ and DX11 are not compatible, but, my VS2010 and DX11 are. On chapter 3 of the book i wrote out the code, linked the libraries and include file of DX11 to VS2010. However, im getting an ungodly amount of errors all related to DX11. On top of that im also getting "[i]System can not find file specified[/i]". Now is there a possibility that the DX11 function calls are different from DX9? If so where can i find the related code in DX11? And two, how can i fix the "System can not find file specified"?

I will include my code if there is possibility of it being a syntax issue.

EDIT:: I would like to note that when i installed DX11 i received a S1023 error.


The following is my code::

[quote]#include<d3d11.h>

#include<windows.h>
#include<time.h>
#include<iostream>
using namespace std;

//#pragma comment(lib,"d3d11.lib")
//#pragma comment(lib, "d3dx11.lib")

const string APPTITLE = "Direct3D_Windowed";
const int SCREENW = 1024;
const int SCREENH = 768;

LPDIRECT3D11 d3d = NULL;
LPDIRECT3DDEVICE11 d3ddev = NULL;


bool gameover = false;

#define KEY_DOWN(vk_code)((GetAsyncKeyState(vk_code)&0x8000)? 1 : 0)

bool Game_Init(HWND window)
{

MessageBox(window, "Game_Init", "BREAKPOINT", 0);

d3d = Direct3DCreate11(D3D_SDK_VERSION);
if(d3d = NULL)
{
MessageBox(window, "Error initializing Direct3D", "Error", MB_OK);
return 0;
}

D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
d3dpp.BackBufferCount = 1;
d3dpp.BackBufferWidth = SCREENW;
d3dpp.BackBufferHeight = SCREENH;
d3dpp.hDeviceWindow = window;

d3d->CreateDevice(
D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
window,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&d3ddev);

if(d3ddev = NULL)
{
MessageBox(window, "Error creating Direct3D device", "Error", MB_OK);
return 0;
}
return true;
}

void Game_Run(HWND hwnd)
{
if(!d3ddev)return;

d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,255,0), 1.0f, 0);

if(d3ddev->BeginScene())
{
//do something

d3ddev->EndScene();

d3ddev->Present(NULL, NULL, NULL, NULL);

}

if(KEY_DOWN(VK_ESCAPE))
PostMessage(hwnd, WM_DESTROY, 0,0);

}

void Game_End(HWND hwnd)
{

MessageBox(hwnd, "Program is about to end", "Game_End", MB_OK);

if(d3ddev) d3ddev->Release();
if(d3d)d3d->Release();
}

LRESULT WINAPI WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
gameover = true;
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc =(WNDPROC)WinProc;
wc.cbClsExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = APPTITLE.c_str();
wc.hIconSm = NULL;
RegisterClassEx(&wc);

HWND window = CreateWindow(APPTITLE.c_str(), APPTITLE.c_str(), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, SCREENW, SCREENH, NULL, NULL, hInstance, NULL);

if(window == 0) return 0;

ShowWindow(window, nCmdShow);
UpdateWindow(window);

if(!Game_Init(window)) return 0;

MSG message;
while(!gameover)
{
if(PeekMessage(&message, NULL, 0,0, PM_REMOVE))
{
TranslateMessage(&message);
DispatchMessage(&message);
}

Game_Run(window);
}
Game_End(window);

return message.wParam;

}[/quote]




The following errors are reported::

[quote]

(15) : error C2146: syntax error : missing ';' before identifier 'd3d'
(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(16) : error C2146: syntax error : missing ';' before identifier 'd3ddev'
(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(28) : error C2065: 'D3D_SDK_VERSION' : undeclared identifier
(28) : error C3861: 'Direct3DCreate11': identifier not found
(35) : error C2065: 'D3DPRESENT_PARAMETERS' : undeclared identifier
(35) : error C2146: syntax error : missing ';' before identifier 'd3dpp'
(35) : error C2065: 'd3dpp' : undeclared identifier
(36) : error C2065: 'd3dpp' : undeclared identifier
(36) : error C2065: 'd3dpp' : undeclared identifier
(36) : error C2070: ''unknown-type'': illegal sizeof operand
(37) : error C2065: 'd3dpp' : undeclared identifier
(37) : error C2228: left of '.Windowed' must have class/struct/union type is ''unknown-type''
(38) : error C2065: 'd3dpp' : undeclared identifier
(38) : error C2228: left of '.SwapEffect' must have class/struct/union type is ''unknown-type''
(38) : error C2065: 'D3DSWAPEFFECT_DISCARD' : undeclared identifier
(39) : error C2065: 'd3dpp' : undeclared identifier
(39) : error C2228: left of '.BackBufferFormat' must have class/struct/union type is ''unknown-type''
(39) : error C2065: 'D3DFMT_X8R8G8B8' : undeclared identifier
(40) : error C2065: 'd3dpp' : undeclared identifier
(40) : error C2228: left of '.BackBufferCount' must have class/struct/union type is ''unknown-type''
(41) : error C2065: 'd3dpp' : undeclared identifier(41) : error C2228: left of '.BackBufferWidth' must have class/struct/union type is ''unknown-type''
(42) : error C2065: 'd3dpp' : undeclared identifier
(42) : error C2228: left of '.BackBufferHeight' must have class/struct/union type is ''unknown-type''
(43) : error C2065: 'd3dpp' : undeclared identifier
(43) : error C2228: left of '.hDeviceWindow' must have class/struct/union type is ''unknown-type''
(45) : error C2227: left of '->CreateDevice' must point to class/struct/union/generic type type is 'int'
(46) : error C2065: 'D3DADAPTER_DEFAULT' : undeclared identifier
(47) : error C2065: 'D3DDEVTYPE_HAL' : undeclared identifier
(49) : error C2065: 'D3DCREATE_SOFTWARE_VERTEXPROCESSING' : undeclared identifier
(50) : error C2065: 'd3dpp' : undeclared identifier
(65) : error C2227: left of '->Clear' must point to class/struct/union/generic type type is 'int'
(65) : error C2065: 'D3DCLEAR_TARGET' : undeclared identifier
(65) : error C3861: 'D3DCOLOR_XRGB': identifier not found
(67) : error C2227: left of '->BeginScene' must point to class/struct/union/generic type type is 'int'
(71) : error C2227: left of '->EndScene' must point to class/struct/union/generic type type is 'int'
(73) : error C2227: left of '->Present' must point to class/struct/union/generic type type is 'int'
(87) : error C2227: left of '->Release' must point to class/struct/union/generic type type is 'int'
(88) : error C2227: left of '->Release' must point to class/struct/union/generic type type is 'int'

[/quote]
0

Share this post


Link to post
Share on other sites
DirectX changed a lot between DirectX 9 and DirectX 11. You can't take DirectX 9 code and change it to DirectX 11 code just by changing the 9s to 11s, and there isn't a simple one to one mapping from the old functions to the new functions.
0

Share this post


Link to post
Share on other sites
[quote name='SiCrane' timestamp='1324693439' post='4896978']
DirectX changed a lot between DirectX 9 and DirectX 11. You can't take DirectX 9 code and change it to DirectX 11 code just by changing the 9s to 11s, and there isn't a simple one to one mapping from the old functions to the new functions.
[/quote]




Thank you for the reply. My next question. What DX9 edition do i need for Windows 7. I have VC++ 2008, those tow should be compatible.
0

Share this post


Link to post
Share on other sites
just use the last DX SDK...

here are some guidelines for Direct3D 11 migration..[url="http://msdn.microsoft.com/en-us/library/ff476190(v=VS.85).aspx"]http://msdn.microsoft.com/en-us/library/ff476190(v=VS.85).aspx[/url]

2

Share this post


Link to post
Share on other sites
[quote name='DarkRadeon' timestamp='1324790147' post='4897207']
just use the last DX SDK...

here are some guidelines for Direct3D 11 migration..[url="http://msdn.microsoft.com/en-us/library/ff476190%28v=VS.85%29.aspx"]http://msdn.microsof...0(v=VS.85).aspx[/url]


[/quote]

Ah, yes. this will be of service, thank you.
0

Share this post


Link to post
Share on other sites
Okay, so I found that DX11 is backwards compatible for DX10 and DX9. I wrote the code in VS2010Professional, and made the neccessary include and library links. The links were linked to DX9 and the code compiled. However some issues persisted. Blow is the fresh code and the list of errors.

[quote]
#include<windows.h>
#include<d3d9.h>
#include<time.h>
#include<iostream>
using namespace std;

const string APPTITLE = "Direct3D_Windowed";
const int SCREENW = 1024;
const int SCREENH = 768;

LPDIRECT3D9 d3d = NULL;
LPDIRECT3DDEVICE9 d3ddev = NULL;


bool gameover = false;

#define KEY_DOWN(vk_code)((GetAsyncKeyState(vk_code)&0x8000)? 1 : 0)

bool Game_Init(HWND window)
{

MessageBox(window, "Game_Init", "BREAKPOINT", 0);

d3d = Direct3DCreate9(D3D_SDK_VERSION);
if(d3d = NULL)
{
MessageBox(window, "Error initializing Direct3D", "Error", MB_OK);
return 0;
}

D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
d3dpp.BackBufferCount = 1;
d3dpp.BackBufferWidth = SCREENW;
d3dpp.BackBufferHeight = SCREENH;
d3dpp.hDeviceWindow = window;

d3d->CreateDevice(
D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
window,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp,
&d3ddev);

if(d3ddev = NULL)
{
MessageBox(window, "Error creating Direct3D device", "Error", MB_OK);
return 0;
}
return true;
}

void Game_Run(HWND hwnd)
{
if(!d3ddev)return;

d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,255,0), 1.0f, 0);

if(d3ddev->BeginScene())
{
//do something

d3ddev->EndScene();

d3ddev->Present(NULL, NULL, NULL, NULL);

}

if(KEY_DOWN(VK_ESCAPE))
PostMessage(hwnd, WM_DESTROY, 0,0);

}

void Game_End(HWND hwnd)
{

MessageBox(hwnd, "Program is about to end", "Game_End", MB_OK);

if(d3ddev) d3ddev->Release();
if(d3d)d3d->Release();
}

LRESULT WINAPI WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
gameover = true;
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc =(WNDPROC)WinProc;
wc.cbClsExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = APPTITLE.c_str();
wc.hIconSm = NULL;
RegisterClassEx(&wc);

HWND window = CreateWindow(APPTITLE.c_str(), APPTITLE.c_str(), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, SCREENW, SCREENH, NULL, NULL, hInstance, NULL);

if(window == 0) return 0;

ShowWindow(window, nCmdShow);
UpdateWindow(window);

if(!Game_Init(window)) return 0;

MSG message;
while(!gameover)
{
if(PeekMessage(&message, NULL, 0,0, PM_REMOVE))
{
TranslateMessage(&message);
DispatchMessage(&message);
}

Game_Run(window);
}
Game_End(window);

return message.wParam;

}
[/quote]


Wheh i run the program the following is generated::

[quote]
ntdll.dll', Cannot find or open the PDB file
kernel32.dll', Cannot find or open the PDB file
KernelBase.dll', Cannot find or open the PDB file
d3d9.dll', Cannot find or open the PDB file
msvcrt.dll', Cannot find or open the PDB file
sechost.dll', Cannot find or open the PDB file
rpcrt4.dll', Cannot find or open the PDB file
sspicli.dll', Cannot find or open the PDB file
cryptbase.dll', Cannot find or open the PDB file
user32.dll', Cannot find or open the PDB file
gdi32.dll', Cannot find or open the PDB file
lpk.dll', Cannot find or open the PDB file
usp10.dll', Cannot find or open the PDB file
advapi32.dll', Cannot find or open the PDB file
version.dll', Cannot find or open the PDB file
d3d8thk.dll', Cannot find or open the PDB file
dwmapi.dll', Cannot find or open the PDB file
msvcp100d.dll', Symbols loaded.
'msvcr100d.dll', Symbols loaded.
apphelp.dll', Cannot find or open the PDB file
AcLayers.dll', Cannot find or open the PDB file
'shell32.dll', Cannot find or open the PDB file
shlwapi.dll', Cannot find or open the PDB file
ole32.dll', Cannot find or open the PDB file
oleaut32.dll', Cannot find or open the PDB file
userenv.dll', Cannot find or open the PDB file
'profapi.dll', Cannot find or open the PDB file
winspool.drv', Cannot find or open the PDB file
mpr.dll', Cannot find or open the PDB file
imm32.dll', Cannot find or open the PDB file
msctf.dll', Cannot find or open the PDB file
[/quote]
^ I get the feeling this has something to do with the output path.

When i press ctrl+F5, the output window is blank, as if it is running. But the window that the code is supposed to produce, does not appear.

So what am i doing wrong?
0

Share this post


Link to post
Share on other sites
You should really check the return value of every API function you call, and when you do you should do more than return 0 when you get an error. At the very minimum for Windows API functions call GetLastError() to find out what caused the problem. In this particular case, at least one of your problems is that you didn't either 0 out or manually assign to every member of the WNDCLASSEX structure.
0

Share this post


Link to post
Share on other sites
[quote name='SiCrane' timestamp='1325296054' post='4898330']
You should really check the return value of every API function you call, and when you do you should do more than return 0 when you get an error. At the very minimum for Windows API functions call GetLastError() to find out what caused the problem. In this particular case, at least one of your problems is that you didn't either 0 out or manually assign to every member of the WNDCLASSEX structure.
[/quote]

Thnak you for the reply. Sorry for thrednomancing. I'd like to request if at all possible that you augment my code. Im not too familiar with DirectX.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • By lonewolff
      Hi Guys,
      I am revisiting an old DX11 framework I was creating a while back and am scratching my head with a small issue.
      I am trying to set the pixel shader resources and am getting the following error on every loop.
      As you can see in the below code, I am clearing out the shader resources as per the documentation. (Even going overboard and doing it both sides of the main PSSet call). But I just can't get rid of the error. Which results in the render target not being drawn.
      ID3D11ShaderResourceView* srv = { 0 }; d3dContext->PSSetShaderResources(0, 1, &srv); for (std::vector<RenderTarget>::iterator it = rtVector.begin(); it != rtVector.end(); ++it) { if (it->szName == name) { //std::cout << it->srv <<"\r\n"; d3dContext->PSSetShaderResources(0, 1, &it->srv); break; } } d3dContext->PSSetShaderResources(0, 1, &srv);  
      I am storing the RT's in a vector and setting them by name. I have tested the it->srv and am retrieving a valid pointer.
      At this stage I am out of ideas.
      Any help would be greatly appreciated
       
    • By bowerbirdcn
      hi, guys, how to understand the math used in CDXUTDirectionWidget ::UpdateLightDir 
      the  following code snippet is taken from MS DXTU source code
       
        D3DXMATRIX mInvView;
          D3DXMatrixInverse( &mInvView, NULL, &m_mView );
          mInvView._41 = mInvView._42 = mInvView._43 = 0;
          D3DXMATRIX mLastRotInv;
          D3DXMatrixInverse( &mLastRotInv, NULL, &m_mRotSnapshot );
          D3DXMATRIX mRot = *m_ArcBall.GetRotationMatrix();
          m_mRotSnapshot = mRot;
          // Accumulate the delta of the arcball's rotation in view space.
          // Note that per-frame delta rotations could be problematic over long periods of time.
          m_mRot *= m_mView * mLastRotInv * mRot * mInvView;
          // Since we're accumulating delta rotations, we need to orthonormalize 
          // the matrix to prevent eventual matrix skew
          D3DXVECTOR3* pXBasis = ( D3DXVECTOR3* )&m_mRot._11;
          D3DXVECTOR3* pYBasis = ( D3DXVECTOR3* )&m_mRot._21;
          D3DXVECTOR3* pZBasis = ( D3DXVECTOR3* )&m_mRot._31;
          D3DXVec3Normalize( pXBasis, pXBasis );
          D3DXVec3Cross( pYBasis, pZBasis, pXBasis );
          D3DXVec3Normalize( pYBasis, pYBasis );
          D3DXVec3Cross( pZBasis, pXBasis, pYBasis );
       
       
      https://github.com/Microsoft/DXUT/blob/master/Optional/DXUTcamera.cpp
    • By YixunLiu
      Hi,
      I have a surface mesh and I want to use a cone to cut a hole on the surface mesh.
      Anybody know a fast method to calculate the intersected boundary of these two geometries?
       
      Thanks.
       
      YL
       
    • By hiya83
      Hi, I tried searching for this but either I failed or couldn't find anything. I know there's D11/D12 interop and there are extensions for GL/D11 (though not very efficient). I was wondering if there's any Vulkan/D11 or Vulkan/D12 interop?
      Thanks!
    • By lonewolff
      Hi Guys,
      I am just wondering if it is possible to acquire the address of the backbuffer if an API (based on DX11) only exposes the 'device' and 'context' pointers?
      Any advice would be greatly appreciated
  • Popular Now