Jump to content
  • Advertisement
Sign in to follow this  

first directx window

This topic is 2444 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm fairly new to programming in a environment that needs to be setup with library's and such. I'm more used to the "Just type stuff"
recently i've been trying to get c++ to work with a graphical lib like DirectX or allegro.
i've got to the point were i need to make a directx controlled(?) window. this works fine except for 2 things.
1. the D3D11CreateDeviceAndSwapChain function is not being resolved.
2. both "dev->Release() " and "devcon->Release()" don't work while "swapchain->Release()" does. i do think the library's and headers are setup correctly but i'm not sure.


Could someone take a look in what i'm doing wrong?

thanks in advance, David.

oh and i'm using the Netbeans IDE for C++, MinGW compiler,and the Microsoft Directx SDK june 2011

Share this post

Link to post
Share on other sites
1: The import library for d3d11 core is d3d11.lib, be sure to link it to your program.

2: If you haven't successfully called D3D11CreateDeviceAndSwapChain, none of the device pointers are valid so they may or may not cause an access violation when you try to use them. In any case, the interfaces do not work as intended unless you've successfully created the objects.

D3D does not technically "control" the window, but the association of a DXGI swap chain does inject some management stuff into the window procedure when you create it (mainly for tracking and manipulating window focus & size and fullscreen state).

Also, June 2011 SDK does not exist. As of this writing, the latest version is June 2010 :)

I'm not sure if MinGW is a supported environment for D3D nowadays.

Share this post

Link to post
Share on other sites
some really weird things are going on now. according to netbeans d3d11.h is linked just fine but the compiler gives this output:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/David/Documents/NetBeansProjects/CppApplication_1'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/cppapplication_1.exe
make[2]: Entering directory `/cygdrive/c/Users/David/Documents/NetBeansProjects/CppApplication_1'
mkdir -p build/Debug/MinGW-Windows
rm -f build/Debug/MinGW-Windows/main.o.d
g++.exe -c -g -I/C/Program\ Files/dxsdk/Include -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
make[2]: Leaving directory `/cygdrive/c/Users/David/Documents/NetBeansProjects/CppApplication_1'
make[1]: Leaving directory `/cygdrive/c/Users/David/Documents/NetBeansProjects/CppApplication_1'
main.cpp:4:19: fatal error: D3D11.h: No such file or directory
compilation terminated.
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 2s)

yes SDK June 2010 but d3d11 (confusing)

it appears asif the lib is not being include properly but i wouldn't have a clue how to get it to work

also MinGW is supported.

Share this post

Link to post
Share on other sites
You have to set the DX SDK include path to the compiler settings (I don't remember how to do this in MinGW, haven't used it for a while).

The error is that it can't find the d3d11.h header file. Assuming that the SDK is properly installed, the headers are found in %DXSDK_DIR%/Include .

In particular, the [color="#008800"]-I/C/Program\ Files/dxsdk/Include [color="#000000"]seems to be incorrect. This type of error is usually caused by omission of the double apostrophes (" ") around paths which causes most command-line programs to split the path string at every space.

Share this post

Link to post
Share on other sites
ok i've got the wrong path issue fixed.
but now i get a LOT of errors:

about 40 of these lines:
c:\Program Files\dxsdk\Include/dxgi.h:286:13: error: '__in' has not been declared
c:\Program Files\dxsdk\Include/dxgi.h:286:19: error: expected ',' or '...' before '&' token

about 10 of these:
c:\Program Files\dxsdk\Include/d3d11.h:1214:13: error: '__out' has not been declared
c:\Program Files\dxsdk\Include/d3d11.h:1214:33: error: expected ',' or '...' before '*' token

and these:
c:\Program Files\dxsdk\Include/d3d11.h:3292:14: error: expected ')' before 'ID3D11Buffer
'c:\Program Files\dxsdk\Include/d3d11.h:3305:14: error: expected ')' before 'ID3D11Texture1D'
main.cpp:153:1: error: expected '}' at end of input In file included from main.cpp:4:0:
c:\Program Files\dxsdk\Include/d3d11.h:3290:5: error: expected unqualified-id at end of input

Share this post

Link to post
Share on other sites
This type of issues generally occur when the headers are not compatible with the build environment.

I could not find anything that suggests D3D11 headers are in fact compatible with MinGW (they'd probably mention that in the SDK docs), so it may simply be that they are not actually supported by your compiler.

To my best understanding, the newer DX headers and libs are only guaranteed to work with Visual Studio 2008 and 2010 as they are - but of course it could be possible to modify them to match other compilers' requirements. Do note that this may present a considerable challenge, as the headers have a lot of stuff in them.

I seem to remember that before D3D9, other compilers were explicitly supported.

In case you don't get your environment to work with the DX SDK, do try the Visual C++ 2010 Express edition, which can be downloaded for free from Microsoft. It supports native Win32 just fine, and does work with the current DX SDK (I've tested it myself). Just be sure to install the Windows SDK too, in order to get the standard Win32 libs and headers.

Share this post

Link to post
Share on other sites
Thank you so much, i guess Directx 10+ is only supported by VS. I don't really like it but i'll get used to it. after copying the code and setting up the include/lib dirs it just instantly worked.

Again thank you! david

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!