Theory: Multiple SDK/DirectX Installations and the C3635/C3377 problems

First off this is what I have installed in regards to .NET, DirectX and Programming Software - all in their own directories.

  • DirectX - October 2005 Edition
  • DirectX - December 2005 Edition
  • DirectX - February 2006 Edition
  • Visual Studio 2005 Express (C#, C++ etc) - Net SDK 2.0, DX Feb2006
  • Visual Studio 2003 C++ - Net SDK 1.1, DX Oct/Dec and Feb (separately)
  • Visual Studio 6 C++ (Not used since 2003 installed last year)
  • Net SDK 1.1
  • Net SDK 2.0

Both before and after installing Feb 2006 DirectX I have found I could not compile a simple program in 2003 C++, just creating a device without receiving 3 or so error messages with the 2 codes in the subject heading.  I have the 1.1 Net SDK setup for includes and libraries as well as using each of the directX assemblies individually.  Normal C++ .NET programs compile but the moment I add the dev = new Device( ... ) line it fails to compile.  Without that line it compiles fine.   I have tried the Microsoft::DirectX::PrivateImplementationDetails workaround suggested but this just causes all sorts of other problems regardless of where I put it.

[code]

  1. Device * m_device;
  2. PresentParameters * m_pp;
  3. m_pp = new PresentParameters();
  4. m_pp->AutoDepthStencilFormat = DepthFormat::D16;
  5. m_pp->BackBufferCount = 1;
  6. m_pp->BackBufferFormat = Format::X8R8G8B8;
  7. m_pp->BackBufferHeight = c->Height;
  8. m_pp->BackBufferWidth = c->Width;
  9. m_pp->DeviceWindow = c;
  10. m_pp->DeviceWindowHandle = c->Handle;
  11. m_pp->EnableAutoDepthStencil = true;
  12. m_pp->FullScreenRefreshRateInHz = 0;
  13. m_pp->MultiSample = MultiSampleType::None;
  14. m_pp->MultiSampleQuality = 0;
  15. m_pp->PresentationInterval = PresentInterval::Immediate;
  16. m_pp->PresentFlag = PresentFlag::DiscardDepthStencil;
  17. m_pp->SwapEffect = SwapEffect::Discard;
  18. m_pp->Windowed = true;
  19. PresentParameters* pArrayParams __gc[] = {m_pp};
  20. m_device = new Device(0, DeviceType::Hardware, c, CreateFlags::SoftwareVertexProcessing, pArrayParams);

[/code]

However, putting the identical code (well almost identical) in 2005 C++ with the .NET 2.0 or .NET 1.1 and any of the DirectX assemblies individually it compiles fine.  Whether this is because I have 2.0 installed I don't know.

[code]

  1. Device^ m_device;
  2. PresentParameters^ m_pp;
  3. m_pp = gcnew PresentParameters();
  4. m_pp->AutoDepthStencilFormat = DepthFormat::D16;
  5. m_pp->BackBufferCount = 1;
  6. m_pp->BackBufferFormat = Format::X8R8G8B8;
  7. m_pp->BackBufferHeight = frm->Height;
  8. m_pp->BackBufferWidth = frm->Width;
  9. m_pp->DeviceWindow = frm;
  10. m_pp->DeviceWindowHandle = frm->Handle;
  11. m_pp->EnableAutoDepthStencil = true;
  12. m_pp->FullScreenRefreshRateInHz = 0;
  13. m_pp->MultiSample = MultiSampleType::None;
  14. m_pp->MultiSampleQuality = 0;
  15. m_pp->PresentationInterval = PresentInterval::Immediate;
  16. m_pp->PresentFlag = PresentFlag::DiscardDepthStencil;
  17. m_pp->SwapEffect = SwapEffect::Discard;
  18. m_pp->Windowed = true;
  19. m_device = gcnew Device(0,DeviceType::Hardware,frm,CreateFlags::SoftwareVertexProcessing,m_pp);

[/code]

So, all I can deduce from this is that you HAVE to use the latest software/SDK installed barring the DirectX.  Can anyone confirm that this is the reason why so many of us are having problems.   I will be testing further by getting my brother to compile my 2003 code on his 1.1 only system and see if it works.  Of course the other option is that 2003 is not fully Managed yet.  In which case can we expect at least that update before support finally finishes on it.

IE.

  • Visual Studio 2003 (Version 7.x) - Only to be used if you DO NOT have .NET 2.0 SDK installed even if not linked to the software.
  • Visual Studio 2005 (Version 8.x) - Can be used with .NET 1.1 and 2.0 SDK

 



Answer this question

Theory: Multiple SDK/DirectX Installations and the C3635/C3377 problems

  • gwc

    Xrystal wrote:

    Okay here goes with the code files. The following are the only files I have in the 2 projects. It was an Empty Project with the same or similar (if identical unavailable) settings and references added. I literally copied and pasted the code from the 2005 working program to the 2003 environment and set everything up and replace __gcnew with __gc new or just new when __gc new didn't want to work and replace ^ with *. And of course the litte problem with the PresentParameters in 2003. I am now down to a working 2005 program and a 2003 program that reports the errors as follows:

    But ^ doesn't correspond to *, it needs to be __gc *


  • wromee

    Well finally got my brother to test on his non .NET 2.0 / Studio 2005 system and he is getting the same problems so nothing related to .NET 2.0 installation. So either 2003/DirectX/Net combo or the project as a whole. Even though the project works fine in 2005 with just changes to the pointer ..

    Just having the DirectX libraries linked in and the one single line of directx code:

    device* m_device; (2003 Version) Won't compile

    device^ m_device; (2005 Version) Will compile

    That line alone will trigger the error .. is there something wrong with what I did there.


  • Frustrated1689

    Okay here goes with the code files.  The following are the only files I have in the 2 projects.  It was an Empty Project with the same or similar (if identical unavailable) settings and references added.  I literally copied and pasted the code from the 2005 working program to the 2003 environment and set everything up and replace __gcnew with __gc new or just new when __gc new didn't want to work and replace ^ with *.  And of course the litte problem with the PresentParameters in 2003.  I am now down to a working 2005 program and a 2003 program that reports the errors as follows:

    [error list start]

    DirectXTestForm.cpp

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3377: 'Microsoft::DirectX::Direct3D::Device::.ctor' : cannot import method - a parameter type or the return type is inaccessible

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3377: 'Microsoft::DirectX::Direct3D::Device::get_UnmanagedComPointer' : cannot import method - a parameter type or the return type is inaccessible

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3377: 'Microsoft::DirectX::Direct3D::Device::UpdateUnmanagedPointer' : cannot import method - a parameter type or the return type is inaccessible

    DXMain.cpp

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3377: 'Microsoft::DirectX::Direct3D::Device::.ctor' : cannot import method - a parameter type or the return type is inaccessible

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3377: 'Microsoft::DirectX::Direct3D::Device::get_UnmanagedComPointer' : cannot import method - a parameter type or the return type is inaccessible

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3377: 'Microsoft::DirectX::Direct3D::Device::UpdateUnmanagedPointer' : cannot import method - a parameter type or the return type is inaccessible

    main.cpp

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3377: 'Microsoft::DirectX::Direct3D::Device::.ctor' : cannot import method - a parameter type or the return type is inaccessible

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3377: 'Microsoft::DirectX::Direct3D::Device::get_UnmanagedComPointer' : cannot import method - a parameter type or the return type is inaccessible

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) : error C3377: 'Microsoft::DirectX::Direct3D::Device::UpdateUnmanagedPointer' : cannot import method - a parameter type or the return type is inaccessible

    [/error list end]

    First off is the main.cpp file.

    [code from 2003]

    1. //Includes
    2. #include "DirectXTestForm.h"
    3. // Main Routine
    4. [STAThreadAttribute]
    5. int main()
    6. {
    7. // Enabling Windows XP visual effects before any controls are created
    8. Application::EnableVisualStyles();
    9. //.NET 2.0 Only Code
    10. //Application::SetCompatibleTextRenderingDefault(false);
    11. DirectXTest::TestForm* frm = __gc new DirectXTest::TestForm();
    12. frm->Show();
    13. frm->InitialiseGraphics();
    14. Application::Run(frm);
    15. return 0;
    16. }

    [/code]

    [code from 2005]

    1. //Includes
    2. #include "DirectXTestForm.h"
    3. // Main Routine
    4. [STAThreadAttribute]
    5. int main()
    6. {
    7. // Enabling Windows XP visual effects before any controls are created
    8. Application::EnableVisualStyles();
    9. Application::SetCompatibleTextRenderingDefault(false);
    10. DirectXTest::TestForm^ frm = gcnew DirectXTest::TestForm();
    11. frm->Show();
    12. frm->InitialiseGraphics();
    13. Application::Run(frm);
    14. return 0;
    15. }

    [/code]

    Now the DirectXTestForm.h files

    [code from 2003]

    1. // Pragmas
    2. #pragma once
    3. // Includes
    4. #include "DXMain.h"
    5. // Namespaces
    6. using namespace DXBase;
    7. using namespace System;
    8. // TestForm class for testing DirectX Display Code
    9. // Source Code
    10. namespace DirectXTest
    11. {
    12. public __gc class TestForm: public Form
    13. {
    14. protected:
    15. private:
    16. Void OnPaint(Object* sender, PaintEventArgs* e);
    17. CDXMain* DXMain;
    18. ~TestForm();
    19. public:
    20. TestForm();
    21. Void InitialiseGraphics();
    22. };
    23. }

    [/code]

    [code from 2005]

    1. // Pragmas
    2. #pragma once
    3. // Includes
    4. #include "DXMain.h"
    5. // Namespaces
    6. using namespace DXBase;
    7. using namespace System;
    8. // TestForm class for testing DirectX Display Code
    9. // Source Code
    10. namespace DirectXTest
    11. {
    12. public ref class TestForm: public Form
    13. {
    14. private:
    15. Void OnPaint(Object^ sender, PaintEventArgs^ e);
    16. CDXMain^ DXMain;
    17. protected:
    18. ~TestForm();
    19. public:
    20. TestForm();
    21. Void InitialiseGraphics();
    22. };
    23. }

    [/code]

    Now DirectXTestForm.cpp

    [code from 2003]

    1. // Includes
    2. #include "DirectXTestForm.h"
    3. namespace DirectXTest
    4. {
    5. TestForm::TestForm()
    6. {
    7. this->SetStyle(static_cast<ControlStyles>(ControlStyles::AllPaintingInWmPaint | ControlStyles::Opaque),true);
    8. this->Size = Drawing::Size(800,600);
    9. this->Text = L"Managed DirectX C++ - Create Device";
    10. this->Paint += new PaintEventHandler(this,&TestForm::OnPaint);
    11. }
    12. TestForm::~TestForm()
    13. {
    14. }
    15. Void TestForm::OnPaint(Object* sender, PaintEventArgs* e)
    16. {
    17. DXMain->StartPaint(Color::CornflowerBlue);
    18. DXMain->EndPaint(this);
    19. }
    20. Void TestForm::InitialiseGraphics()
    21. {
    22. DXMain = __gc new CDXMain(this);
    23. }
    24. }

    [/code]

    [code from 2005]

    1. // Includes
    2. #include "DirectXTestForm.h"
    3. namespace DirectXTest
    4. {
    5. TestForm::TestForm()
    6. {
    7. this->SetStyle(ControlStyles::AllPaintingInWmPaint | ControlStyles::Opaque, true);
    8. this->Size = Drawing::Size(800,600);
    9. this->Text = L"Managed DirectX C++ - Create Device";
    10. this->Paint += gcnew PaintEventHandler(this,&TestForm::OnPaint);
    11. }
    12. TestForm::~TestForm()
    13. {
    14. }
    15. Void TestForm::OnPaint(Object^ sender, PaintEventArgs^ e)
    16. {
    17. DXMain->StartPaint(Color::CornflowerBlue);
    18. DXMain->EndPaint(this);
    19. }
    20. Void TestForm::InitialiseGraphics()
    21. {
    22. DXMain = gcnew CDXMain(this);
    23. }
    24. }

    [/code]

    2 More to go .. this time DXMain.h

    [code from 2003]

    1. // Pragmas
    2. #pragma once
    3. // Includes
    4. // Namespaces used in this Class
    5. using namespace System::Windows::Forms;
    6. using namespace System::Drawing;
    7. using namespace Microsoft::DirectX;
    8. using namespace Microsoft::DirectX::Direct3D;
    9. namespace DXBase
    10. {
    11. public __gc class CDXMain
    12. {
    13. protected:
    14. private:
    15. ~CDXMain(void);
    16. Device* m_device;
    17. PresentParameters* m_pp;
    18. public:
    19. CDXMain(void);
    20. CDXMain(Control* frm);
    21. Device* GetDevice(void);
    22. PresentParameters* GetPP(void);
    23. void StartPaint(Color color);
    24. void EndPaint(Form* frm);
    25. };
    26. }

    [/code]

    [code from 2005]

    1. // Pragmas
    2. #pragma once
    3. // Includes
    4. // Namespaces used in this Class
    5. using namespace System::Windows::Forms;
    6. using namespace System::Drawing;
    7. using namespace Microsoft::DirectX;
    8. using namespace Microsoft::DirectX::Direct3D;
    9. namespace DXBase
    10. {
    11. ref class CDXMain
    12. {
    13. protected:
    14. private:
    15. ~CDXMain(void);
    16. Device^ m_device;
    17. PresentParameters^ m_pp;
    18. public:
    19. CDXMain(void);
    20. CDXMain(Control^ frm);
    21. Device^ GetDevice(void);
    22. PresentParameters^ GetPP(void);
    23. void StartPaint(Color color);
    24. void EndPaint(Form^ frm);
    25. };
    26. }

    [/code]

    And finally DXMain.cpp

    [code from 2003]

    1. // Includes
    2. #include "DXMain.h"
    3. namespace DXBase
    4. {
    5. CDXMain::CDXMain(void)
    6. {
    7. }
    8. CDXMain::CDXMain(Control* frm)
    9. {
    10. m_pp = __gc new PresentParameters();
    11. m_pp->AutoDepthStencilFormat = DepthFormat::D16;
    12. m_pp->BackBufferCount = 1;
    13. m_pp->BackBufferFormat = Format::X8R8G8B8;
    14. m_pp->BackBufferHeight = frm->Height;
    15. m_pp->BackBufferWidth = frm->Width;
    16. m_pp->DeviceWindow = frm;
    17. m_pp->DeviceWindowHandle = frm->Handle;
    18. m_pp->EnableAutoDepthStencil = true;
    19. m_pp->FullScreenRefreshRateInHz = 0;
    20. m_pp->MultiSample = MultiSampleType::None;
    21. m_pp->MultiSampleQuality = 0;
    22. m_pp->PresentationInterval = PresentInterval::Immediate;
    23. m_pp->PresentFlag = PresentFlag::DiscardDepthStencil;
    24. m_pp->SwapEffect = SwapEffect::Discard;
    25. m_pp->Windowed = true;
    26. PresentParameters* pArrayParams __gc[] = {m_pp};
    27. m_device = __gc new Device(0,DeviceType::Hardware,frm,CreateFlags::SoftwareVertexProcessing,pArrayParams);
    28. }
    29. CDXMain::~CDXMain(void)
    30. {
    31. }
    32. Device* CDXMain::GetDevice(void)
    33. {
    34. return m_device;
    35. }
    36. PresentParameters* CDXMain::GetPP(void)
    37. {
    38. return m_pp;
    39. }
    40. void CDXMain::StartPaint(Color color)
    41. {
    42. m_device->Clear(ClearFlags::Target, Color::CornflowerBlue, 1.0f, 0);
    43. m_device->BeginScene();
    44. }
    45. void CDXMain::EndPaint(Form* frm)
    46. {
    47. m_device->EndScene();
    48. m_device->Present();
    49. frm->Invalidate();
    50. }
    51. }

    [/code]

    [code from 2005]

    1. // Includes
    2. #include "DXMain.h"
    3. namespace DXBase
    4. {
    5. CDXMain::CDXMain(void)
    6. {
    7. }
    8. CDXMain::CDXMain(Control^ frm)
    9. {
    10. m_pp = gcnew PresentParameters();
    11. m_pp->AutoDepthStencilFormat = DepthFormat::D16;
    12. m_pp->BackBufferCount = 1;
    13. m_pp->BackBufferFormat = Format::X8R8G8B8;
    14. m_pp->BackBufferHeight = frm->Height;
    15. m_pp->BackBufferWidth = frm->Width;
    16. m_pp->DeviceWindow = frm;
    17. m_pp->DeviceWindowHandle = frm->Handle;
    18. m_pp->EnableAutoDepthStencil = true;
    19. m_pp->FullScreenRefreshRateInHz = 0;
    20. m_pp->MultiSample = MultiSampleType::None;
    21. m_pp->MultiSampleQuality = 0;
    22. m_pp->PresentationInterval = PresentInterval::Immediate;
    23. m_pp->PresentFlag = PresentFlag::DiscardDepthStencil;
    24. m_pp->SwapEffect = SwapEffect::Discard;
    25. m_pp->Windowed = true;
    26. m_device = gcnew Device(0,DeviceType::Hardware,frm,CreateFlags::SoftwareVertexProcessing,m_pp);
    27. }
    28. CDXMain::~CDXMain(void)
    29. {
    30. }
    31. Device^ CDXMain::GetDevice(void)
    32. {
    33. return m_device;
    34. }
    35. PresentParameters^ CDXMain::GetPP(void)
    36. {
    37. return m_pp;
    38. }
    39. void CDXMain::StartPaint(Color color)
    40. {
    41. m_device->Clear(ClearFlags::Target, Color::CornflowerBlue, 1.0f, 0);
    42. m_device->BeginScene();
    43. }
    44. void CDXMain::EndPaint(Form ^ frm)
    45. {
    46. m_device->EndScene();
    47. m_device->Present();
    48. frm->Invalidate();
    49. }
    50. }

    [/code]

    As you can see the code are almost identical.  So if anyone can shed any light on why I get those errors I would be glad to test them out on those 2 projects.

    Now reference wise the two projects both have the following:

    • System.XML (1.0 for 2003 and 2.0 for 2005)
    • System.Windows.Forms (1.0 for 2003 and 2.0 for 2005)
    • System.Drawing (1.0 for 2003 and 2.0 for 2005)
    • System  (1.0 for 2003 and 2.0 for 2005)
    • System.Data (1.0 for 2003 and 2.0 for 2005)
    • Microsoft.DirectX   (1.0.2902)
    • Microsoft.DirectX.Direct3D  (1.0.2902)
    • Microsoft.DirectX.Direct3DX (1.0.2902)

    However, I also had to add mscorlib 1.0 into the 2003 for it to understand the __gc command.   Now the 1.0 .NET library is from 1.1.4322 installation and the 2.0 version is from 2.0.50727.

    Hopefully this is enough for anyone that might want to check it out.  Bear in mind that this wasn't a request for help just a possible theory as to the cause that perhaps others with the same problem could confirm or deny based on their setups.


  • Achelon

    Sorry should have pointed out which lines the errors actually refer to .  In the programmed code there are blank lines I put in to separate blocks of code which this forum spaces together when I paste it in and make it readable.

    Line 32 actually points to the end of the class meaning something in the class as a whole is the problem usually as far as I know.  And that class holds all my DirectX code.

    Went through and remvoed all Include directories in 2003 until I only had DirectX Feb 2006 and .NET SDK 1.1 directories listed.  Similarly for the Library list.   Still the same error when built.

    Hmm interesting .. I removed all the DirectX specific elements to the code and rebuilt and got one error.

    LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'

    Obviously because I removed an important directory from the includes and libraries path listings that including directx doesn't notice due to their error being more important. 

    Added path for PlatformSDK include and library which I took out before and the following error appears:

    LINK : fatal error LNK1104: cannot open file 'LIBCMTD.lib'

    Aha finally .. added path to v7 include and libraries and it now compiles fine .. now added the dxmain.h and dxmain.cpp into the application and the references and built it .. the errors are back ..

    Like I said .. its just a curious theory so I'm not going to waste time trying to figure out why the basic code I have just won't compile when 2005 is working just fine .. until I have tested it on another computer that doesn't have the 2.0 libraries installed and retrieved the same problem I will just assume its the version thats at fault.

    Thanks for your assistance on this .. I know I've been pulling my hair out regarding it the last 6 months :D

     ... Got Home from work and created another project in 2003 and copied the code out of the old multi file class project into a single file ... here it is ..

    [code]

    1. // Namespaces
    2. using namespace System;
    3. using namespace System::Windows::Forms;
    4. using namespace System::Drawing;
    5. using namespace Microsoft::DirectX;
    6. using namespace Microsoft::DirectX::Direct3D;
    7. namespace DirectXTest
    8. {
    9. public __gc class TestForm: public Form
    10. {
    11. protected:
    12. Device* m_device;
    13. PresentParameters* m_pp;
    14. private:
    15. Void OnPaint(Object* sender, PaintEventArgs* e)
    16. {
    17. StartPaint(Color::CornflowerBlue);
    18. EndPaint(this);
    19. }
    20. ~TestForm()
    21. {
    22. }
    23. public:
    24. TestForm()
    25. {
    26. this->SetStyle(static_cast<ControlStyles>(ControlStyles::AllPaintingInWmPaint | ControlStyles::Opaque),true);
    27. this->Size = Drawing::Size(800,600);
    28. this->Text = L"Managed DirectX C++ - Create Device";
    29. this->Paint += new PaintEventHandler(this,&TestForm::OnPaint);
    30. }
    31. Void InitialiseGraphics()
    32. {
    33. /*
    34. m_pp = __gc new PresentParameters();
    35. m_pp->AutoDepthStencilFormat = DepthFormat::D16;
    36. m_pp->BackBufferCount = 1;
    37. m_pp->BackBufferFormat = Format::X8R8G8B8;
    38. m_pp->BackBufferHeight = frm->Height;
    39. m_pp->BackBufferWidth = frm->Width;
    40. m_pp->DeviceWindow = frm;
    41. m_pp->DeviceWindowHandle = frm->Handle;
    42. m_pp->EnableAutoDepthStencil = true;
    43. m_pp->FullScreenRefreshRateInHz = 0;
    44. m_pp->MultiSample = MultiSampleType::None;
    45. m_pp->MultiSampleQuality = 0;
    46. m_pp->PresentationInterval = PresentInterval::Immediate;
    47. m_pp->PresentFlag = PresentFlag::DiscardDepthStencil;
    48. m_pp->SwapEffect = SwapEffect::Discard;
    49. m_pp->Windowed = true;
    50. PresentParameters* pArrayParams __gc[] = {m_pp};
    51. */
    52. // m_device = __gc new Device(0,DeviceType::Hardware,frm,CreateFlags::SoftwareVertexProcessing,pArrayParams);
    53. }
    54. /*
    55. Device* GetDevice(void)
    56. {
    57. return m_device;
    58. }
    59. */
    60. /*
    61. PresentParameters* GetPP(void)
    62. {
    63. return m_pp;
    64. }
    65. */
    66. void StartPaint(Color color)
    67. {
    68. /*
    69. m_device->Clear(ClearFlags::Target, Color::CornflowerBlue, 1.0f, 0);
    70. m_device->BeginScene();
    71. */
    72. }
    73. void EndPaint(Form* frm)
    74. {
    75. /*
    76. m_device->EndScene();
    77. m_device->Present();
    78. */
    79. frm->Invalidate();
    80. }
    81. };
    82. }
    83.  
    84. // Main Routine
    85. [STAThreadAttribute]
    86. int main()
    87. {
    88. // Enabling Windows XP visual effects before any controls are created
    89. Application::EnableVisualStyles();
    90. //.NET 2.0 Only Code
    91. //Application::SetCompatibleTextRenderingDefault(false);
    92. DirectXTest::TestForm* frm = __gc new DirectXTest::TestForm();
    93. frm->Show();
    94. frm->InitialiseGraphics();
    95. Application::Run(frm);
    96. return 0;
    97. }

    [/code]

    I remmed and re-remmed and unremmed out code to see which code added will cause the error ..

    This project setup causes the following messages (Line 83 is the closing brace for the class, just before the namespace close brace) :

    AllInOne.cpp

    AllInOne.cpp(83) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    AllInOne.cpp(83) : error C3377: 'Microsoft::DirectX::Direct3D::Device::.ctor' : cannot import method - a parameter type or the return type is inaccessible

    AllInOne.cpp(83) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    AllInOne.cpp(83) : error C3377: 'Microsoft::DirectX::Direct3D::Device::get_UnmanagedComPointer' : cannot import method - a parameter type or the return type is inaccessible

    AllInOne.cpp(83) : error C3635: 'Microsoft.DirectX.PrivateImplementationDetails::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

    AllInOne.cpp(83) : error C3377: 'Microsoft::DirectX::Direct3D::Device::UpdateUnmanagedPointer' : cannot import method - a parameter type or the return type is inaccessible

    As you can see from this code the only directx specific code is the two variable setups .. If I rem out those 2 lines it compiles with no problems .. I have tried this using the October and February files set up in the directory list (only one at a time though of course). 


  • Naokazu Tsukada

    If you look at your error message:

    > d:\My Documents\Visual Studio .NET Projects\DirectX C++ .NET 2003 Step By Step\CreateDevice_2003\DXMain.h(33) :


    You will notice that it references line 33 of file DXMain.h. The file DXMain.h you posted above only has 26 lines. Thus, it seems as if you're picking up some file other than what you think you're picking up.

    Check the include path options for both your project (C++ options) and for visual studio (Options -> project settings -> Visual studio directories -> Included files)
    ; you'll probably see some paths that shouldn't be there.




  • David_W

    If it fails to compile, you need to copy and paste the error message you get from the compiler, and the lines around where indicated by the error message, into your message asking for help.

    In fact, if you can create a 20-line file that generates the error, then please post the contents of that file, as well as a copy-and-paste of the error messages you are getting. Then someone might have a chance of figuring out what you're doing wrong (which possibly might have something to do with references, paths for finding them, or something totally different).


  • helpmeimstupid

    I wasn't asking for help as such, I have pretty much given up on 2003 as a .NET programming environment. I was just wondering if everyone else having the problem had a similar multiple install of software.

    Also, the project isn't just a 20 line file. Its just that those 20 lines of code are the only difference between the code I added and not generated by the Project Creator for Windows Forms in 2003 and 2005. I'm in the process of making a minimalised project to use as little code as possible and will post them up here once I have done both versions of code.

    The directory and reference settings are identical as they are in the same place barring the 1.1 and 2.0 .Net SDK which I have confirmed are included properly. Normal 2003 .NET programs compile (went through the first 20 projects of a .NET 2003 tutorial book over the last 2 weeks with no problems at all. The only problem occurred after the introduction of DirectX which is the same version used in 2005 with no problems. So, with that in mind I can only assume there are differences in code somewhere and with a Windows Forms System Generated app that would be harder to find hence the attempt at narrowing it down to my code and not Microsofts generated code.


  • rileyjim

    Well, looks like I got it working now .. this is the AllInOne code as it is and it compiles.  Hopefully this will help others with similar problems.  I think my problem was that I was placing the unmanaged includes (the workaround listed on various sites) in the wrong place.

    [code]

    1. namespace Microsoft
    2. {
    3. namespace DirectX
    4. {
    5. namespace PrivateImplementationDetails
    6. {
    7. #include <d3d9.h>
    8. #include <d3dx9.h>
    9. }
    10. }
    11. }
    12. // Namespaces
    13. using namespace System;
    14. using namespace System::Windows::Forms;
    15. using namespace System::Drawing;
    16. using namespace Microsoft::DirectX;
    17. using namespace Microsoft::DirectX::Direct3D;
    18. public __gc class TestForm: public Form
    19. {
    20. protected:
    21. Device* m_device;
    22. PresentParameters* m_pp;
    23. private:
    24. Void OnPaint(Object* sender, PaintEventArgs* e)
    25. {
    26. StartPaint(Color::CornflowerBlue);
    27. EndPaint(this);
    28. }
    29. ~TestForm()
    30. {
    31. }
    32. public:
    33. TestForm()
    34. {
    35. this->SetStyle(static_cast<ControlStyles>(ControlStyles::AllPaintingInWmPaint | ControlStyles::Opaque),true);
    36. this->Size = Drawing::Size(800,600);
    37. this->Text = L"Managed DirectX C++ - Create Device";
    38. this->Paint += new PaintEventHandler(this,&TestForm::OnPaint);
    39. }
    40. Void InitialiseGraphics()
    41. {
    42. m_pp = __gc new PresentParameters();
    43. m_pp->AutoDepthStencilFormat = DepthFormat::D16;
    44. m_pp->BackBufferCount = 1;
    45. m_pp->BackBufferFormat = Format::X8R8G8B8;
    46. m_pp->BackBufferHeight = this->Height;
    47. m_pp->BackBufferWidth = this->Width;
    48. m_pp->DeviceWindow = this;
    49. m_pp->DeviceWindowHandle = this->Handle;
    50. m_pp->EnableAutoDepthStencil = true;
    51. m_pp->FullScreenRefreshRateInHz = 0;
    52. m_pp->MultiSample = MultiSampleType::None;
    53. m_pp->MultiSampleQuality = 0;
    54. m_pp->PresentationInterval = PresentInterval::Immediate;
    55. m_pp->PresentFlag = PresentFlag::DiscardDepthStencil;
    56. m_pp->SwapEffect = SwapEffect::Discard;
    57. m_pp->Windowed = true;
    58. PresentParameters* pArrayParams __gc[] = {m_pp};
    59. m_device = __gc new Direct3D::Device(0,DeviceType::Hardware,this,CreateFlags::SoftwareVertexProcessing,pArrayParams);
    60. }
    61. __property Device* get_Device(void)
    62. {
    63. return m_device;
    64. }
    65. __property PresentParameters* get_PP(void)
    66. {
    67. return m_pp;
    68. }
    69. void StartPaint(Color color)
    70. {
    71. m_device->Clear(ClearFlags::Target, Color::CornflowerBlue, 1.0f, 0);
    72. m_device->BeginScene();
    73. }
    74. void EndPaint(Form* frm)
    75. {
    76. m_device->EndScene();
    77. m_device->Present();
    78. frm->Invalidate();
    79. }
    80. };
    81.  
    82. // Main Routine
    83. [STAThreadAttribute]
    84. int main()
    85. {
    86. // Enabling Windows XP visual effects before any controls are created
    87. Application::EnableVisualStyles();
    88. //.NET 2.0 Only Code
    89. //Application::SetCompatibleTextRenderingDefault(false);
    90. TestForm* frm = __gc new TestForm();
    91. frm->Show();
    92. frm->InitialiseGraphics();
    93. Application::Run(frm);
    94. return 0;
    95. }

    [/code]

    In my class based project I had to put that namespace set up at the top of DXMain.h before it would compile.

    edit:

    Just tried this in a normal auto generated Windows Form Application and for the life of me I cannot see where those namespace lines need to go.   Fortunately you can add Windows Forms as needed from within a blank project which will still compile as needed.  Oh well at least 2003 can now be used with Managed DirectX :D


  • Theory: Multiple SDK/DirectX Installations and the C3635/C3377 problems