Directx 10 and managed C++

Started by
6 comments, last by wxb1 18 years, 1 month ago
From I read in books you supposed to be able to mix managed and unmanaged code but... It get all kinds of compile errors when I try to include the directx headers files... It did a few searches and it seems you can't mix unmanaged directx and managed c++... Can someone clear this up for me?
Advertisement
i think you cant do that.And another problem: How to compile mixed code :D
You can mix Managed C++ and unmanaged C++ by using the #pragma unmanaged and #pragma managed directives.

Whenever you want the following code to be compiled managed you set the directive... so.
#pragma managed
...managed code
#pragma unmanaged
...unmanaged code

I hope this helps.
Take care.
Well, that didn't work... the include files are generating all kinds of errors... how can I stop the errors?

I just added the following to my managed cpp file:

#include <windows.h>
#include <DXGI.h>


And I get all theses errors:

------ Build started: Project: DX10Test, Configuration: Debug Win32 ------
Compiling...
Main.cpp
F:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\objbase.h(398) : error C2146: syntax error : missing ';' before identifier 'IRpcStubBuffer'
F:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\objbase.h(398) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.
.
.
F:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\objidl.h(114) : error C2146: syntax error : missing ';' before identifier 'IEnumMoniker'
F:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\objidl.h(114) : fatal error C1003: error count exceeds 100; stopping compilation
Build log was saved at "file://f:\Users\wxb1\Documents\Visual Studio 2005\Projects\DX10Test\DX10Test\Debug\BuildLog.htm"
DX10Test - 103 error(s), 25 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
if u paste a part of your code that is making the error i think we could help u better
Using any include files causes this problem... I created a basic managed application using the templates when you create a new project... If I add windows.h or dxgi.h to the source file I get hundreds of errors... If I comment out windows.h or dxgi.h I get no errors... I did write some code but I commented out all the additional code I had written to try to isolate the problem... I'm using vc8 express...
Quote:Original post by wxb1
Using any include files causes this problem... I created a basic managed application using the templates when you create a new project... If I add windows.h or dxgi.h to the source file I get hundreds of errors... If I comment out windows.h or dxgi.h I get no errors... I did write some code but I commented out all the additional code I had written to try to isolate the problem... I'm using vc8 express...

There is no support right now for managed D3D10, so it could very well be some type of compatability issue. Generally, the managed D3D10 timeline is a lot like it was with managed D3D9 - when D3D10 is complete & stable, then work on the managed wrapper will begin.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
I know there is no managed dx10 right now... I was under the impression I could mix managed and unmanaged in the same source file? I'd build some managed classes that call unmanaged dx10... Is this possible? Are there any examples out on the net of being able to do this?

If not my idea is to do a light COM wrapper for DX10 in VC7 and play around with managed dx9 on VC8...

This topic is closed to new replies.

Advertisement