Linking DirectX - c++

I am working on a DirectX9 project, and it is time now to start doing sprites, and to do so, I need d3dx9.h included, so after a while of trying to get it linked properly, which itself was confusing because it found d3d9.h just fine and its in the same location as d3dx9, I assumed that I would just need to add it to additional libraries, and after a while it finally worked. However upon running the program I get an error, from d3dx9core.h:
C2061: syntax error: identifier 'TEXTMETRICA'
I cannot find any answers online, and cannot figure out what is causing this problem. The line of code is 330 of d3dx9core.h, STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE; it comes with four errors, all pointing to this line. Any thoughts?

If you use the legacy DirectX SDK with VS 2015 or later, you need to make sure the DXSDK include/lib paths are after the standard Windows 8.1 SDK / Windows 10 SDK paths. This is because the legacy DirectX SDK has out-of-date copies of some Windows headers.
Details are covered at the bottom of Microsoft Docs.
DirectX 9 is very old, and really was only needed to target Windows XP. You should look at DirectX 11 instead, and in particular DirectX Tool Kit's SpriteBatch. See Living without D3DX.

Related

Upgraded to win 10 and then my Direct3D11 project wouldn't link

This is a very specific problem, - I apologize for that.
I've been building a graphical real-time application using Direct3D 11. I started it on the Win7 OS. I then upgraded to Win10 and when I tried compiling the solution again, the linker barfed like it had caught the plague for silicon microchips.
It spews out Unresolved symbols in objects that don't even use the given functions.
__imp__wassert
strlen
fabs
__imp__CrtDbgReportW
sprt
and more
I've concluded that the majority of the functions in question is mostly C functions. I'm aware that the c functions are no longer included in the C++ headers and libraries, so I made sure to include all the relevant C-libraries explicitly.
I've read and followed the solutions of some of most of the other folks having problems with Windows 10 screwing their code. one of them is this : Upgraded to Windows 10 and now WAMP won't work
I also tried actually telling the linker where to look for the -lib-files, in case the compiler or project missed the memo.
On my PC, the location for the Direct3D libs is here: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\arm64
As you can see, I am trying to force it to use Win10 lib versions in case this was a requirement.
I started in one end to try and catch myself doing something stupid:
I looked for full include paths to see it this had started an avalanche: FAILED
I tried removing the /ZI compiler option: FAILED
Relinking the DirectX libs to all different version one at the time: FAILED
Explicitly include the vcrumtime.lib to the additional linker libs: SUCCESS (removed half the errors)
Create An entirely new project and include everything from scratch: FAILED
Add MSVCRTD.lib : FAILED
Change the target platform to 64bit: FAILED
Tried including stdio.h in certain independant tool classes: FAILED
Tried including Winmm.lib in the linker: FAILED
I've roamed the internet for what feels like a decade (only a month irl) to find some solution, but nothing.
I hope some of you have an idea of what noobiness I might have committed.
All suggestions will help.
Most likely you are linking with a static library that is not compatible with VS 2015 because it uses the Universal CRT. For example, the legacy DirectX SDK library DXERR.LIB fails to link when using VS 2015. Make sure you rebuild all your code with VS 2015 and avoid the use of static libraries build for other versions of Visual C++.
You also won't be able to get your project to link and run on an x86 or x64 PC linking with the 64-bit ARM libraries.
You do not need to use the Windows 10 SDK for Win32 desktop apps, although you certainly can.

VS2013 C++: Ignore Platform Include Folder

I have a problem when moving to our company's build system over which I have limited control. They have installed DirectX SDK plus Windows 8.1 SDK... My applications is using 8.1 specific features that conflict with DirectX SDK (it's deprecated for a reason). So basically, they have the DirectX SDK hardwired into include lookup and thus headers will resolve to it instead of Windows SDK.
Is there a way to exclude specific folders from "#include" lookup no matter if they were specified? Or is there a way to remove the DirectX SDK from the built-in lookup by some MSBuild command line argument etc?
Hypothetical Solution:
IgnoreIncludeDirectories="C:/program files/directx SDK/include"
:)
Thanks!
Actually it was easy.
set DXSDK_DIR=
%run your build script%
I am not sure if that is a general solution, but it worked and was suggested by one of our build engineers :). Maybe it will help someone else too.

OpenGL, freeGLut, and GLEW on Surface Pro

I am currently taking a college course in Computer Graphics and we are using Visual Studio 2012.
I am trying to get it set up to use freeGLUT and GLEW, but am currently not having any progress.
I have searched everywhere, but have not had any luck finding anything on using a Surface Pro to do this. My professor managed to get it to work on a desktop with Windows 8, but has not tried with a Surface Pro.
I currently do not have any other system to do this on or else I would use one, nor do I have the funds to purchase something else. The Surface Pro has been great for everything else so far, just not this.
UPDATE
I have had some better luck so far using GLEE and freeGLUT. I am now getting this error.
1>C:\Program Files (x86)\Windows Kits\8.0\Include\um\GL/gl.h(1157): error C2054: expected '(' to follow 'WINGDIAPI'
I included windows.h and now it is saying there are syntax errors in my gl.h
UPDATE 2
Program works now. the dll files are with the project files. I also had to reinstall Visual Studio 2012. Good news is IT WORKS! Thanks for those who showed interest and tried to help.
Like as always when it comes to OpenGL, Microsoft makes it not easy, because for some reason (we can only speculate about) they don't like OpenGL. Hence ever since Windows Vista they ship their products with no, or only limited OpenGL support.
The first step is, to go to Intel.com and download the latest OpenGL drivers for the GPU the Surface Pro uses.
This should give you proper OpenGL support, though the Intel drivers for Windows are only mediocre.

OpenGL in WIndows7

I want to write code in OpenGL using Visual Studio 2010 . Now on opening opengl.org , I am redirected to http://user.xmission.com/~nate/glut.html ; which presumes I am using WindowsXP and Visual Studio 6 . The instructions in this page http://user.xmission.com/~nate/glut/README-win32.txt dates back to 2001 , and not in current context .
Long story short, is there any tutorial which will help me to program with OpenGL in Windows 7 using Visual Studio 2010 .
Thanks in advance for taking the time to answer my question . I am new to this , so please bear with me.
OpenGL development under Window-7 is the very same as it has been for Windows-NT 4, Windows 2k and Windows XP. All the tutorials remain valid.
You do not require a OpenGL SDK. Everything you need ships with your compiler. OpenGL is not a library, but an API implemented by the drivers. So make sure you download and install the most recent drivers directly from your GPU's vendor's homepage (don't use the drivers shipping with Windows, because those have only very limited support for OpenGL).
Since you surely want to use recent OpenGL functionality you should however get the GLEW library, which eases up the loading process for the so called "extensions" by several orders of magnitude; highly recommended. Then instead of the regular OpenGL header you include GL/glew.h and call glewInit() right after an OpenGL context has been made active.
Instead of the old, outdated, no longer maintained GLUT, you should use FreeGLUT or OpenGLUT; if using GLUT at all, because you'll hit its limitations very soon. I recommend using GLFW instead.
First of all, configure your project to link with opengl32.lib etc.:
OpenGL config in Visual Studio 2010.
Look at some NeHe tutorials http://nehe.gamedev.net/.
What about Visual Studio 2010 and Windows 7 - I don't think there is some significant differences in API with previous versions of Visual Studio and Windows (at least for simple examples).
Also look at: OpenGL API Documentation Overview

redefinition of typedef errors in unofficial opengl sdk

using the arcsynthesis opengl tutorial and I'm trying to build the unofficial sdk that the examples use, per the instructions here: http://glsdk.sourceforge.net/docs/html/pg_build.html#page_build_libs . (I'm using code::blocks and the gnu gcc compiler, and 0.4.0 of the unofficial sdk) It's not working, I get this error:
C:\libs\c\glsdk_0.4.0\glload\source\wgll_ext_base.h|29|error: redefinition of typedef 'GLenum'|
C:\libs\c\glsdk_0.4.0\glload\source\gll_gl_ext_base.h|27|note: previous declaration of 'GLenum' was here|
repeated several times for other sybmols, including GLBoolean, GLBitField, etc. since I'm pretty sure I'm not supposed to fix this by actually modifying the sdk I'm assuming it's a build/linker muckup on my part, but I'm only using the workspace that premake4 generated, not rolling my own or anything.
arcsynthesis opengl tutorial and I'm trying to build the unofficial sdk that the examples use, per the instructions here: http://glsdk.sourceforge.net/docs/html/pg_build.html#page_build_libs .
The Tutorial distribution comes with the SDK; it's in the folder called glsdk. You aren't supposed to download the SDK from the SDK site. The Tutorial build instruction explain how to build it.
Also, the 0.4.0 version is somewhat old; there was a build problem with Code::Blocks (and probably other builds). The most recent release is 0.4.2, which should work.
Follow the premake instructions for vs2010
In Code::Blocks, go to file-->import project-->Microsoft Visual Studio Solution
Import openglsdk.sln from the directory where you placed the sdk files
Now the sdk will be available as a workspace in Code::Blocks. As of this post, the Unofficial OpenGL SDK is version 0.50. I answered this with step by step directions because I couldn't find any for Code::Blocks, and some people just beginning to learn OpenGL may need a little guidance.