Sign in to follow this  

Directx 10 and managed C++

This topic is 4299 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

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 ==========

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

This topic is 4299 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.

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