   Unresolved external symbol linking error
  I have been trying to go through a DirectX tutorial at https://www.directxtutorial.com.I am assuming the code is correct, yet I keep getting linking errors. I want to get this working so I can at least play around with the code while I am following along through the tutorial. I have tried looking through the forums for help, without any luck. I found other posts with similar issues, but nothing I could use.I am using Visual Studio 2005 and have already installed Microsoft DirectX SDK (Nov 2008). I also have already tried manually adding both library and header files to the path directory. Keep in mind that I am very new at this. Thank you for any help!Here is the code:// blah.cpp : Defines the entry point for the console application.#include &lt;stdafx.h&gt;// include the basic windows header files and the Direct3D header file#include &lt;windows.h&gt;#include &lt;windowsx.h&gt;#include &lt;d3d9.h&gt;// include the Direct3D Library file#pragma comment (lib, "d3d9.lib")// global declarationsLPDIRECT3D9 d3d;    // the pointer to our Direct3D interfaceLPDIRECT3DDEVICE9 d3ddev;    // the pointer to the device class// function prototypesvoid initD3D(HWND hWnd);    // sets up and initializes Direct3Dvoid render_frame(void);    // renders a single framevoid cleanD3D(void);    // closes Direct3D and releases memory// the WindowProc function prototypeLRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);// the entry point for any Windows programint WINAPI WinMain(HINSTANCE hInstance,    HINSTANCE hPrevInstance,    LPSTR lpCmdLine,    int nCmdShow){    HWND hWnd;    WNDCLASSEX wc;    ZeroMemory(&wc, sizeof(WNDCLASSEX));    wc.cbSize = sizeof(WNDCLASSEX);    wc.style = CS_HREDRAW | CS_VREDRAW;    wc.lpfnWndProc = WindowProc;    wc.hInstance = hInstance;    wc.hCursor = LoadCursor(NULL, IDC_ARROW);    wc.hbrBackground = (HBRUSH)COLOR_WINDOW;    wc.lpszClassName = L"WindowClass";    RegisterClassEx(&wc);    hWnd = CreateWindowEx(NULL, L"WindowClass", L"Our First Direct3D Program", WS_OVERLAPPEDWINDOW, 300, 300, 800, 600, NULL, NULL, hInstance, NULL);    ShowWindow(hWnd, nCmdShow);    // set up and initialize Direct3D    initD3D(hWnd);    // enter the main loop:    MSG msg;    while(TRUE)    {   while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))   {  TranslateMessage(&msg);  DispatchMessage(&msg);   }   if(msg.message == WM_QUIT)  break;   render_frame();    }    // clean up DirectX and COM    cleanD3D();    return msg.wParam;}// this is the main message handler for the programLRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){    switch(message)    {   case WM_DESTROY:  { PostQuitMessage(0); return 0;  } break;    }    return DefWindowProc (hWnd, message, wParam, lParam);}// this function initializes and prepares Direct3D for usevoid initD3D(HWND hWnd){    d3d = Direct3DCreate9(D3D_SDK_VERSION);    // create the Direct3D interface    D3DPRESENT_PARAMETERS d3dpp;    // create a struct to hold various device information    ZeroMemory(&d3dpp, sizeof(d3dpp));    // clear out the struct for use    d3dpp.Windowed = TRUE;    // program windowed, not fullscreen    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;    // discard old frames    d3dpp.hDeviceWindow = hWnd;    // set the window to be used by Direct3D    // create a device class using this information and the info from the d3dpp stuct    d3d-&gt;CreateDevice(D3DADAPTER_DEFAULT,  D3DDEVTYPE_HAL,  hWnd,  D3DCREATE_SOFTWARE_VERTEXPROCESSING,  &d3dpp,  &d3ddev);}// this is the function used to render a single framevoid render_frame(void){    // clear the window to a deep blue    d3ddev-&gt;Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0);    d3ddev-&gt;BeginScene();    // begins the 3D scene    // do 3D rendering on the back buffer here    d3ddev-&gt;EndScene();    // ends the 3D scene    d3ddev-&gt;Present(NULL, NULL, NULL, NULL);   // displays the created frame on the screen}// this is the function that cleans up Direct3D and COMvoid cleanD3D(void){    d3ddev-&gt;Release();    // close and release the 3D device    d3d-&gt;Release();    // close and release Direct3D}[Edited by - Malder on June 21, 2009 1:36:36 AM]
Quote:Original post by MalderI also have already tried manually adding both library and header files to the path directory.The path being your project directory, or the %PATH%?  No matter, because you should configure the directories from Visual Studio and not from your paths.  Go to Tools->Options->Projects and Solutions->VC++ Directories*, select "Include Files" from the combo box under "Show directories for" label, and add a new entry, and navigate to the include directory of your DirectX SDK include directory.  Select "Library files", and do the same for the DirectX SDK libraries directory.  Lather, rinse, and repeat.*If the "VC++ Directories" item does not appear under the options menu, load a C++ project, and try again.Also, use [source][/source] tags to format your code in a pretty box.   ;Source tags are your friend.  You didn't tell us what externals are unresolved (exactly what errors is the compiler giving you?).  It could be anything, so without further knowledge we can't really help.  But make sure you're linking to the required libs, like the DirectX libs or whatever other 3rd party libraries you're using.[edit]ninja'd++;   ;Quote:The path being your project directory, or the %PATH%?  No matter, because you should configure the directories from Visual Studio and not from your paths.  Go to Tools->Options->Projects and Solutions->VC++ Directories*, select "Include Files" from the combo box under "Show directories for" label, and add a new entry, and navigate to the include directory of your DirectX SDK include directory.  Select "Library files", and do the same for the DirectX SDK libraries directory.  Rinse, lather, and repeat.*If the "VC++ Directories" item does not appear under the options menu, load a C++ project, and try again.Also, use [source][/source] tags to format your code in a pretty box.Sorry, I actually did just configure the directories in the VC ++ directory and did not mess with the %PATH% as you mentioned above and I forgot to use tags to format the code.Here is what message I recieved after trying to build the project:1>Linking...1>MSVCRTD.lib(wcrtexe.obj) : error LNK2019: unresolved external symbol __imp__InterlockedExchange@8 referenced in function ___tmainCRTStartup1>MSVCRTD.lib(wcrtexe.obj) : error LNK2019: unresolved external symbol __imp__Sleep@4 referenced in function ___tmainCRTStartup1>MSVCRTD.lib(wcrtexe.obj) : error LNK2019: unresolved external symbol __imp__InterlockedCompareExchange@12 referenced in function ___tmainCRTStartup1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__QueryPerformanceCounter@4 referenced in function ___security_init_cookie1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__GetTickCount@0 referenced in function ___security_init_cookie1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__GetCurrentThreadId@0 referenced in function ___security_init_cookie1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__GetCurrentProcessId@0 referenced in function ___security_init_cookie1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__GetSystemTimeAsFileTime@4 referenced in function ___security_init_cookie1>MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__FatalAppExitA@8 referenced in function ___security_init_cookie1>MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol __imp__RaiseException@16 referenced in function "int __cdecl DebuggerProbe(unsigned long)" (?DebuggerProbe@@YAHK@Z)1>MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol __imp__DebugBreak@0 referenced in function "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPAXHHPBD@Z)1>MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol __imp__WideCharToMultiByte@32 referenced in function "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPAXHHPBD@Z)1>MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol __imp__IsDebuggerPresent@0 referenced in function "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPAXHHPBD@Z)1>MSVCRTD.lib(gs_report.obj) : error LNK2001: unresolved external symbol __imp__IsDebuggerPresent@01>MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol __imp__MultiByteToWideChar@24 referenced in function "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPAXHHPBD@Z)1>MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol __imp__lstrlenA@4 referenced in function "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z)1>MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol __imp__GetProcAddress@8 referenced in function "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z)1>MSVCRTD.lib(pdblkup.obj) : error LNK2001: unresolved external symbol __imp__GetProcAddress@81>MSVCRTD.lib(error.obj) : error LNK2019: unresolved external symbol __imp__LoadLibraryA@4 referenced in function "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z)1>MSVCRTD.lib(pdblkup.obj) : error LNK2001: unresolved external symbol __imp__LoadLibraryA@41>MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __imp__HeapFree@12 referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __imp__HeapAlloc@12 referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __imp__GetProcessHeap@0 referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __imp__GetModuleFileNameW@12 referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __imp__VirtualQuery@12 referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)1>MSVCRTD.lib(pdblkup.obj) : error LNK2019: unresolved external symbol __imp__FreeLibrary@4 referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPAUHINSTANCE__@@XZ)1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp__TerminateProcess@8 referenced in function ___report_gsfailure1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp__GetCurrentProcess@0 referenced in function ___report_gsfailure1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp__UnhandledExceptionFilter@4 referenced in function ___report_gsfailure1>MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp__SetUnhandledExceptionFilter@4 referenced in function ___report_gsfailure   ;  You're not linking to the correct C Runtime Library (CRT). More than likely you'll need to link to the Multi-threaded Debug DLL.You'll need to make sure that you set your project to use the correct form of the CRT libraries. I can't think of the setting screen off the top of my head but if you're building in Debug mode you probably want to link to the Multi-Threaded Debug version. If that doesn't work, try just the Debug DLL.Hope this helps.   ;Quote:Original post by leeor_netYou're not linking to the correct C Runtime Library (CRT). More than likely you'll need to link to the Multi-threaded Debug DLL.You'll need to make sure that you set your project to use the correct form of the CRT libraries. I can't think of the setting screen off the top of my head but if you're building in Debug mode you probably want to link to the Multi-Threaded Debug version. If that doesn't work, try just the Debug DLL.Hope this helps.I tried linking the Multi-Threaded Debug version and it just failed to build.1>cl : Command line error D8016 : '/MTd' and '/clr' command-line options are incompatibleI just switched it back to the Multi-Threaded Debug DLL I had to set to originally. Is there anything else you can think of?   