Fehler bei der Direct3D 11 Initialisierung (LNK2019;LNK1120)
-
Hallo,
bei folgendem Programm kommt bei mir die Fehlermeldung "LNK2019 Verweis auf nicht aufgelöstes externes Symbol "_main" in Funktion ""int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)"." in der Datei "MSVCRTD.lib(exe_main.obj)" sowie "LNK1120 1 nicht aufgelöste Externe" in der .exe.
Ich verwende VS 2015 RC und habe die Bibliotheksverzeichnisse, Includeverzeichnisse und ausführbaren Verzeichnisse von der DX SDK hinzugefügt.//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 the Direct3D Library file #pragma comment (lib, "d3d11.lib") #pragma comment (lib, "d3dx11.lib") #pragma comment (lib, "d3dx10.lib") //global declarations IDXGISwapChain *swapchain; //the pointer to the swap chain interface ID3D11Device *dev; //the pointer to our Direct3D device interface ID3D11DeviceContext *devcon; //the pointer to our Direct3D device context //function prototypes void InitD3D (HWND hWnd); //sets up and initializes Direct3D void CleanD3D(void); //closes Direct3D and releases memory //the WindowProc function prototype LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); //this function initializes and prepares Direct3D for use void InitD3D(HWND hWnd) { //create a struct to hold information about the swap chain DXGI_SWAP_CHAIN_DESC scd; //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 = 4; //how many multisamples scd.Windowed = TRUE; //windowed/full-screen mode //create a device, device context and swap chain using the information in the scd struct D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, NULL, NULL, NULL, D3D11_SDK_VERSION, &scd, &swapchain, &dev, NULL, &devcon); HRESULT D3D11CreateDeviceAndSwapChain( IDXGIAdapter *pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, UINT Flags, D3D_FEATURE_LEVEL *pFeatrueLevels, UINT FeatureLevels, UINT SDKVersion, DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, IDXGISwapChain **ppSwapChain, ID3D11Device **ppDevice, D3D_FEATURE_LEVEL *pFeatureLevel, ID3D11DeviceContext **ppDeviceContext); } //this is the function that cleans up Direct3D and COM void CleanD3D(void) { //close and release all existing COM objects swapchain->Release(); dev->Release(); devcon->Release(); }
-
Blöde Frage am Rande: Dein Programm hat auch eine main()-Funktion, oder? Falls du allerdings den gesamten Code gepostet hast, ist die Fehlermeldung nicht verwunderlich.
Finngean