Aloshi / EmulationStation

A flexible emulator front-end supporting keyboardless navigation and custom system themes.
MIT License
2.07k stars 905 forks source link

Fix compilation under Visual Studio 2010 #360

Open enodr opened 9 years ago

enodr commented 9 years ago

Some fixes which allow to compile with Visual Studio 2010:

1/ VS2010 does not know about round, so we need to add a custom define:

#include <math.h>
#define round(x) ((x < 0) ? (ceil((x)-0.5)) : (floor((x)+0.5)))

2/ In GuiGamelistOptions.cpp force the return type as bool or else VS2010 will refuse to compile:

row.input_handler = [&](InputConfig* config, Input input) -> bool {
fausto4ever commented 9 years ago

I made some similar corrections but I can't compile. Please help me.

Error 13 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup” ES\es-app\MSVCRTD.lib(crtexe.obj) emulationstation

enodr commented 9 years ago

Here are some comments I wrote while trying to compile under VS. Maybe some of theses are not accurate because I spent a few hours fixing everything and maybe did not report correctly each time what I did. Hope this helps anyway.

Building Windows:

Solution:

Remove boost*.lib in "Linker -> Input -> Additional Dependencies" kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;C:\boost_1_57_0\lib32-msvc-10.0\boost_system-vc100-mt-1_57.lib;C:\boost_1_57_0\lib32-msvc-10.0\boost_filesystem-vc100-mt-1_57.lib;C:\boost_1_57_0\lib32-msvc-10.0\boost_date_time-vc100-mt-1_57.lib;C:\Users\default\Downloads\curl-7.39.0-devel-mingw32\lib\libcurl.a;....\Release\pugixml.lib;....\Release\nanosvg.lib;winmm.lib;glu32.lib;opengl32.lib;....\Release\es-core.lib;C:\boost_1_57_0\lib32-msvc-10.0\boost_system-vc100-mt-1_57.lib;C:\boost_1_57_0\lib32-msvc-10.0\boost_filesystem-vc100-mt-1_57.lib;C:\boost_1_57_0\lib32-msvc-10.0\boost_date_time-vc100-mt-1_57.lib;C:\Users\default\Downloads\curl-7.39.0-devel-mingw32\lib\libcurl.a;....\Release\pugixml.lib;....\Release\nanosvg.lib;winmm.lib;glu32.lib;opengl32.lib

kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;C:\Users\default\Downloads\curl-7.39.0-devel-mingw32\lib\libcurl.a;....\Release\pugixml.lib;....\Release\nanosvg.lib;winmm.lib;glu32.lib;opengl32.lib;....\Release\es-core.lib;C:\boost_1_57_0\lib32-msvc-10.0\boost_system-vc100-mt-1_57.lib;C:\boost_1_57_0\lib32-msvc-10.0\boost_filesystem-vc100-mt-1_57.lib;C:\boost_1_57_0\lib32-msvc-10.0\boost_date_time-vc100-mt-1_57.lib;C:\Users\default\Downloads\curl-7.39.0-devel-mingw32\lib\libcurl.a;....\Release\pugixml.lib;....\Release\nanosvg.lib;winmm.lib;glu32.lib;opengl32.lib

Linker: Additional library Directories: C:/boost_1_57_0/lib32-msvc-10.0;C:/boost_1_57_0/lib32-msvc-10.0/$(Configuration);%(AdditionalLibraryDirectories)

Problem: 2>main.obj : error LNK2019: unresolved external symbol _SDL_PushEvent referenced in function "public: void __thiscall `anonymous namespace'::::operator()(void)const " (??R@?A0x7b5b62d6@@QBEXXZ) 2>GuiMenu.obj : error LNK2001: unresolved external symbol _SDL_PushEvent 2>es-core.lib(InputManager.obj) : error LNK2001: unresolved external symbol _SDL_PushEvent

Solution: Add C:\Users\default\Downloads\SDL2-2.0.0\lib\x86\SDL2.lib

Problem: 2>Scraper.obj : error LNK2019: unresolved external symbol impFreeImage_Save@16 referenced in function "bool cdecl resizeImage(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,int,int)" (?resizeImage@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HH@Z) 2>Scraper.obj : error LNK2019: unresolved external symbol impFreeImage_Unload@4 referenced in function "bool cdecl resizeImage(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,int,int)" (?resizeImage@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HH@Z) 2>es-core.lib(ImageIO.obj) : error LNK2001: unresolved external symbol impFreeImage_Unload@4

Solution: Add C:\Users\default\Downloads\FreeImage\Dist\FreeImage.lib

Problem: 2>es-core.lib(HttpReq.obj) : error LNK2019: unresolved external symbol impcurl_easy_cleanup referenced in function "public: thiscall HttpReq::~HttpReq(void)" (??1HttpReq@@QAE@XZ) 2>es-core.lib(HttpReq.obj) : error LNK2019: unresolved external symbol impcurl_multi_strerror referenced in function "public: thiscall HttpReq::~HttpReq(void)" (??1HttpReq@@QAE@XZ)

Solution: Need to build libcurl for Visual Studio. Link with libcurl.lib

Problem: 3>es-core.lib(Font.obj) : error LNK2019: unresolved external symbol _FT_Init_FreeType referenced in function "public: static void cdecl Font::initLibrary(void)" (?initLibrary@Font@@SAXXZ) 3>es-core.lib(Font.obj) : error LNK2019: unresolved external symbol _FT_Done_Face referenced in function "private: void __thiscall Font::buildAtlas(struct ResourceData)" (?buildAtlas@Font@@AAEXUResourceData@@@Z) 3>es-core.lib(Font.obj) : error LNK2019: unresolved external symbol _FT_Load_Char referenced in function "private: void thiscall Font::buildAtlas(struct ResourceData)" (?buildAtlas@Font@@AAEXUResourceData@@@Z) 3>es-core.lib(Font.obj) : error LNK2019: unresolved external symbol _FT_Set_Pixel_Sizes referenced in function "private: void thiscall Font::buildAtlas(struct ResourceData)" (?buildAtlas@Font@@AAEXUResourceData@@@Z) 3>es-core.lib(Font.obj) : error LNK2019: unresolved external symbol _FT_New_Memory_Face referenced in function "private: void thiscall Font::buildAtlas(struct ResourceData)" (?buildAtlas@Font@@AAEXUResourceData@@@Z)

Solution: Add C:\Users\default\Downloads\freetype-2.4.9\objs\win32\vc2010\freetype249.lib

Problem: MSVCRT.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

Solution: Add C:\Users\default\Downloads\SDL2-2.0.0\lib\x86\SDL2main.lib

fausto4ever commented 9 years ago

Tks. Works!!