1 Replies - 6384 Views - Last Post: 24 June 2012 - 03:47 PM

#1 SICGames2012   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 10-March 12

How can I make my function candidates accessible?

Posted 24 June 2012 - 11:27 AM

I created a Managed Assembly using DirectX 11 for my level editor. I rebuilt the solution and program for the DLL and it works. Now, when I go into a test project it gives me SIC_Editor::Device::Init candidate functions not accessible. I am new to learning C++ but I feel I'm getting a grasp on things. However, C++ and C# are a bit different I noticed and what I've read is that C++ is the processor of C#. I Google'd this error and it was referring to managed calls to non-managed. So, I'm guessing the function's calls are not publicly made. I did declare the functions in the main CPP program because without it I would get compiling errors for the DLL. So, thanks for taking your time and reviewing the code. I'm sure it's something simply and it's probably laughing at my face! You know how it is when the problem is taunting you.

#pragma once
		// include the basic windows header files and the Direct3D header files
#include <windows.h>
#include <windowsx.h>
#include <d3d11.h>
#include <d3dx11.h>
#include <d3dx10.h>
#include <tchar.h>

// include the Direct3D Library file
#pragma comment (lib, "d3d11.lib")
#pragma comment (lib, "d3dx11.lib")
#pragma comment (lib, "d3dx10.lib")

using namespace System;

namespace SIC_Editor {

	 public ref class Device

// function prototypes
static  void Init(HWND hWnd);    // sets up and initializes Direct3D
 static void Render(void);     // renders a single frame
 static void Clear(void);        // closes Direct3D and releases memory


#include "stdafx.h"

#include "SIC_Editor.h"

namespace SIC_Editor {


		// global declarations
static public IDXGISwapChain *swapchain;             // the pointer to the swap chain interface
static  public ID3D11Device *dev;                     // the pointer to our Direct3D device interface
static  public ID3D11DeviceContext *devcon;           // the pointer to our Direct3D device context
static public  ID3D11RenderTargetView *backbuffer;    // the pointer to our back buffer

// this function initializes and prepares Direct3D for use
 void Device::Init(HWND hWnd)
    // create a struct to hold information about the swap chain

    // clear out the struct for use
    ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC));

    // fill the swap chain description struct
    scd.BufferCount = 1;                                    // one back buffer
    scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;     // use 32-bit color
    scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;      // how swap chain is to be used
    scd.OutputWindow = hWnd;                                // the window to be used
    scd.SampleDesc.Count = 1;                               // how many multisamples
    scd.SampleDesc.Quality = 0;                             // multisample quality level
    scd.Windowed = TRUE;                                    // windowed/full-screen mode

    // create a device, device context and swap chain using the information in the scd struct

    // get the address of the back buffer
    ID3D11Texture2D *pBackBuffer;
    swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);

    // use the back buffer address to create the render target
    dev->CreateRenderTargetView(pBackBuffer, NULL, &backbuffer);

    // set the render target as the back buffer
    devcon->OMSetRenderTargets(1, &backbuffer, NULL);

    // Set the viewport
    D3D11_VIEWPORT viewport;
    ZeroMemory(&viewport, sizeof(D3D11_VIEWPORT));

    viewport.TopLeftX = 0;
    viewport.TopLeftY = 0;
    viewport.Width = 800;
    viewport.Height = 600;

    devcon->RSSetViewports(1, &viewport);

This is the windows form in C++ that's giving the function candidate issue.

private: System::Void DX9Form_Shown(System::Object^  sender, System::EventArgs^  e) 

The windows form C++ is in another project. I figured i just make a managed framework I can work in for simplicity sake.

Thanks for pointing me in the right direction guys! Much appreciated!

Is This A Good Question/Topic? 0
  • +

Replies To: How can I make my function candidates accessible?

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: How can I make my function candidates accessible?

Posted 24 June 2012 - 03:47 PM

Moved to CLI C++
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1