Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 751907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:43:16+00:00 2026-05-14T14:43:16+00:00

Having trouble creating my swap chain. I receive the following error. DX3dApp.obj : error

  • 0

Having trouble creating my swap chain. I receive the following error.

DX3dApp.obj : error LNK2019: unresolved external symbol _D3D10CreateDeviceAndSwapChain@32 referenced in function "public: bool __thiscall DX3dApp::InitDirect3D(void)" (?InitDirect3D@DX3dApp@@QAE_NXZ)

Below is the code ive done so far.

#include "DX3dApp.h"




bool DX3dApp::Init(HINSTANCE hInstance, int width, int height)
{
    mhInst = hInstance;
    mWidth = width;
    mHeight = height;

    if(!WindowsInit())
    {
        return false;
    }
    if(!InitDirect3D())
    {
        return false;
    }
}

int DX3dApp::Run()
{
     MSG msg = {0};

     while (WM_QUIT != msg.message)
    {
        while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) == TRUE)
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

        Render();
    }

    return (int) msg.wParam;
}

bool DX3dApp::WindowsInit()
{
    WNDCLASSEX wcex;

    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.style          = CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc    = (WNDPROC)WndProc;
    wcex.cbClsExtra     = 0;
    wcex.cbWndExtra     = 0;
    wcex.hInstance      = mhInst;
    wcex.hIcon          = 0;
    wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
    wcex.lpszMenuName   = NULL;
    wcex.lpszClassName  = TEXT("DirectXExample");
    wcex.hIconSm        = 0;
    RegisterClassEx(&wcex);

    // Resize the window
    RECT rect = { 0, 0, mWidth, mHeight };
    AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);

    // create the window from the class above
    mMainhWnd = CreateWindow(TEXT("DirectXExample"), 
                             TEXT("DirectXExample"), 
                             WS_OVERLAPPEDWINDOW,
                             CW_USEDEFAULT, 
                             CW_USEDEFAULT, 
                             rect.right - rect.left, 
                             rect.bottom - rect.top, 
                             NULL, 
                             NULL, 
                             mhInst, 
                             NULL);
   if (!mMainhWnd)
   {
      return false;
   }

   ShowWindow(mMainhWnd, SW_SHOW);
   UpdateWindow(mMainhWnd);

   return true;
}

bool DX3dApp::InitDirect3D()
{
    DXGI_SWAP_CHAIN_DESC scd;
    ZeroMemory(&scd, sizeof(scd));

    scd.BufferCount = 1;
    scd.BufferDesc.Width = mWidth;
    scd.BufferDesc.Height = mHeight;
    scd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
    scd.BufferDesc.RefreshRate.Numerator = 60;
    scd.BufferDesc.RefreshRate.Denominator = 1;
    scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
    scd.OutputWindow = mMainhWnd;
    scd.SampleDesc.Count = 1;
    scd.SampleDesc.Quality = 0;
    scd.Windowed = TRUE;

    HRESULT hr = D3D10CreateDeviceAndSwapChain(NULL,D3D10_DRIVER_TYPE_REFERENCE,
                                                NULL,
                                                0,
                                                D3D10_SDK_VERSION,
                                                &scd,
                                                &mpSwapChain,
                                                &mpD3DDevice);

    if(!hr != S_OK)
    {
        return FALSE;
    }

    ID3D10Texture2D *pBackBuffer;

    return TRUE;
}

void DX3dApp::Render()
{

}


LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message) 
    {
        // Allow the user to press the escape key to end the application
        case WM_KEYDOWN:
            switch(wParam)
            {
                // Check if the user hit the escape key
                case VK_ESCAPE:
                    PostQuitMessage(0);
                break;
            }
        break;

        // The user hit the close button, close the application
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
    }
    return DefWindowProc(hWnd, message, wParam, lParam);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:43:16+00:00Added an answer on May 14, 2026 at 2:43 pm

    You are not linking against the D3D library (D3D10.lib).

    Add that library to your linker options (Project properties -> Linker -> Input -> Additional Dependencies). You will need to make sure the library location is in the “Additional Library Directories” path as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble creating a port in Unix. This code keeps returning Error creating
I'm having trouble creating a mouseover function with an NSTableView. The idea is that
I'm using LINQ to Entities (not LINQ to SQL) and I'm having trouble creating
I'm creating my own dictionary and I am having trouble implementing the TryGetValue function.
I having trouble in dividing the HTML frames. I have been using the following
I'm having trouble creating a solid game engine for my OpenGL application. It's a
I'm having trouble creating a table and I don't understand what's wrong. phpMyAdmin sets
I am having trouble creating an export of my database using an org.dbunit.database.QueryDataSet. When
I am having trouble creating an XML document that contains a default namespace and
I'm having trouble creating a new model row in the database using ActiveRecord in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.