Compiler error creating managed c++ directx app

From: Mark Snyder (snyderm_at_otc.edu)
Date: 04/22/04


Date: Thu, 22 Apr 2004 12:24:39 -0500

Hello,
I'm trying to create a simple program using managed C++ and DirectX. I
can't even get started because I can't get my program to compile, when all
I'm doing is trying to create a Device object.

Here is the source code I am using:
System::Void InitializeGraphics()
{
    PresentParameters* pp = new PresentParameters();
    pp->Windowed = true;
    pp->SwapEffect = SwapEffect::Discard;
    pDevice = new Device(0, DeviceType::Hardware, this,
CreateFlags::SoftwareVertexProcessing, pp);
}

I get the following errors on the line where I call the constructor for
Device:

---------------------------------------
c:\Documents and Settings\snyderm\Desktop\Try3D\Form1.h(75) : error C3635:
'Microsoft.DirectX.InteropData::IDirect3DDevice9': undefined native type
used in 'Microsoft::DirectX::Direct3D::Device'; imported native types must
be defined in the importing source code
did you forget to include a header file?
c:\Documents and Settings\snyderm\Desktop\Try3D\Form1.h(75) : error C3377:
'Microsoft::DirectX::Direct3D::Device::.ctor' : cannot import method - a
parameter type or the return type is inaccessible
c:\Documents and Settings\snyderm\Desktop\Try3D\Form1.h(75) : error C3635:
'Microsoft.DirectX.InteropData::IDirect3DDevice9': undefined native type
used in 'Microsoft::DirectX::Direct3D::Device'; imported native types must
be defined in the importing source code
did you forget to include a header file?
c:\Documents and Settings\snyderm\Desktop\Try3D\Form1.h(75) : error C3377:
'Microsoft::DirectX::Direct3D::Device::GetUnmanagedPointer' : cannot import
method - a parameter type or the return type is inaccessible
c:\Documents and Settings\snyderm\Desktop\Try3D\Form1.h(75) : error C2664:
'Microsoft::DirectX::Direct3D::Device::Device(int,Microsoft::DirectX::Direct
3D::DeviceType,System::IntPtr,Microsoft::DirectX::Direct3D::CreateFlags,Micr
osoft::DirectX::Direct3D::PresentParameters __gc * __gc[])' : cannot convert
parameter 5 from 'Microsoft::DirectX::Direct3D::PresentParameters __gc *' to
'System::IntPtr'
No constructor could take the source type, or constructor overload
resolution was ambiguous
---------------------------------------

The only changes from a basic Windows Forms Application are:
1. I went to Tools-Options, Projects-VC++ Directories, Reference Files, and
added an entry for the "C:\WINDOWS\Microsoft.NET\Managed DirectX\v9.02.1195"
folder,
2. I have added references to "Microsoft.DirectX.Direc3D" and
"Microsoft.DirectX" to References in Solution Explorer,
3. I added "using namespace Microsoft::DirectX::Direct3D;" to my source
file, and
4. I added a data member to my Form1 class like: "Device* pDevice;"

My guess is that there is some other configuration step I am missing?

Any help appreciated,
Mark



Relevant Pages

  • Re: [Lit.] Buffer overruns
    ... #defining the symbols within the source code you control you can inhibit ... any preprocessor overrides of those symbols. ... I prefer that the conflict be ... You can even automate it by creating a header file such as define_C.h ...
    (sci.crypt)
  • Re: beginners questions
    ... # (I work on Linux 2.4.22/Debian) ... Some supply the source code, ... second #define converts them into old style K+R function declarations. ... use the same header file for two different styles of compilation. ...
    (comp.lang.c)
  • Re: could someone give me hints on drawing a bezier surface?
    ... can easily adapt the source code for bezier surfaces.. ... > control matrixs, etc. ... I learned them from the tutorials in DirectX SDK ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: #ifdef
    ... It may be defined by the user, or somewhere in a header file, ... out of a larger context such as the OS source code ... C code after preprocessing but before compiling. ... in tracking down issues with preprocessor symbols. ...
    (comp.lang.c)
  • Re: Managed Editor for a C++ Engine?
    ... to get updated source code. ... This book will at least help with th DirectX aspect of a user interface. ... > A friend of mine is in the process of building a 3d engine using native ... I would like to contribute to the development of an editor ...
    (microsoft.public.win32.programmer.directx.managed)