在Visual Studio 2013中使用SDL 2.0.1得到LNK2019错误 [英] Im getting LNK2019 errors using SDL 2.0.1 in visual studio 2013

查看:313
本文介绍了在Visual Studio 2013中使用SDL 2.0.1得到LNK2019错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是错误代码和这里
[VectorEngine.h]

#ifndef _CAPP_H_
#define _CAPP_H_
#include  <SDL.h>

class VectorEngine 
{

    private: 

            bool                     running;
            SDL_Window*        Surf_Display;

    public:
                              VectorEngine();
            void                 onExecute();
            bool                    OnInit();
            void   OnEvent(SDL_Event* Event);
            void                    OnTick();
            void                  OnRender();
            void                 OnCLeanup();
};
#endif

[Main.cpp] >

[Main.cpp]

#include"VectorEngine.h"
#include <Windows.h>


const int TICKS_PER_SECOND = 25;
const int SKIP_TICKS = 1000 / TICKS_PER_SECOND;
const int MAX_RENDERSKIPS = 5;


    VectorEngine::VectorEngine()
{
    Surf_Display = NULL;
    running = true;
    OnInit();
    onExecute();

}

    void VectorEngine::onExecute()
{   
        SDL_Event Event;
        DWORD next_game_tick = GetTickCount();
        while (running)
        {
            int skippedRenders = 0;
            while (GetTickCount()> next_game_tick && skippedRenders < MAX_RENDERSKIPS)
            {
                OnTick();
                next_game_tick += SKIP_TICKS;
                skippedRenders++;
            }
            OnRender();

        }


}

    int main (int argc, char* argv[])
{
        VectorEngine  *vecEngine = new VectorEngine();
        return 0;
}

[Oninit.cpp]

[Oninit.cpp]

    #include "VectorEngine.h"

  bool VectorEngine::OnInit()
{

        SDL_Init(SDL_INIT_EVERYTHING);
        Surf_Display = SDL_CreateWindow("My Game Window",
            SDL_WINDOWPOS_UNDEFINED,
            SDL_WINDOWPOS_UNDEFINED,
            640, 480,
            SDL_WINDOW_SHOWN| SDL_WINDOW_OPENGL);


        return true;
}

[OnCLeanup.cpp]

[OnCLeanup.cpp]

#include"VectorEngine.h"

    void VectorEngine::OnCLeanup()
{
        SDL_Quit();
}

是所有代码的链接an [here]()


是所有链接器设置的链接:

Is the link to all the code an [here]() Is the link to all the linker settings:

Error   5   error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup C:\Users\XSoloDoloX\Desktop\VecEng\GameForReal\GameForReal\MSVCRTD.lib(crtexew.obj) GameForReal

Error   2   error LNK2019: unresolved external symbol _SDL_Quit referenced in function "public: void __thiscall VectorEngine::OnCLeanup(void)" (?OnCLeanup@VectorEngine@@QAEXXZ)    C:\Users\XSoloDoloX\Desktop\VecEng\GameForReal\GameForReal\OnCleanup.obj    GameForReal

Error   4   error LNK2019: unresolved external symbol _SDL_Init referenced in function "public: bool __thiscall VectorEngine::OnInit(void)" (?OnInit@VectorEngine@@QAE_NXZ) C:\Users\XSoloDoloX\Desktop\VecEng\GameForReal\GameForReal\OnInit.obj   GameForReal

Error   3   error LNK2019: unresolved external symbol _SDL_CreateWindow referenced in function "public: bool __thiscall VectorEngine::OnInit(void)" (?OnInit@VectorEngine@@QAE_NXZ) C:\Users\XSoloDoloX\Desktop\VecEng\GameForReal\GameForReal\OnInit.obj   GameForReal

Error   6   error LNK1120: 4 unresolved externals   C:\Users\XSoloDoloX\Desktop\VecEng\GameForReal\Debug\GameForReal.exe    1   1   GameForReal


推荐答案

Ok所以我想出了由于某些原因使用x64库导致错误,所以使用x86修复了问题!

Ok So I figured it out for some reason using the x64 libraries was causing the errors so using x86 fixed the problems!

这篇关于在Visual Studio 2013中使用SDL 2.0.1得到LNK2019错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆