MengeCrowdSim / Menge

The source code for the Menge crowd simulation framework
Apache License 2.0
138 stars 64 forks source link

Can't build in VS 2015 #42

Closed curds01 closed 7 years ago

curds01 commented 7 years ago

The Menge code base isn't compatible with Visual Studio 2015. This is a known problem that comes down both to compilation as well as linker problems.

chraibi commented 7 years ago

Is this problem related to the osx linker problems?

erikvullings commented 7 years ago

Compilation problems seemed relatively small, e.g. by editing the following code in macros.h, I could get the compilation working:

//#ifdef _WIN32
//      #include <hash_map>
//      #define HASH_MAP stdext::hash_map
//#else
        #include <unordered_map>
        #define HASH_MAP std::unordered_map
//#endif

Linker problems still remained, though, but maybe a replacement of libpng.lib is enough:

Severity             Code    Description       Project File       Line      Suppression State
Error     LNK2019           unresolved external symbol __imp___snprintf referenced in function _png_create_write_struct_2   MengeCore      c:\dev\Menge-master\projects\VS2013\Menge\libpng.lib(pngwrite.obj)    1           
Warning            LNK4075           ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification              MengeCore      c:\dev\Menge-master\projects\VS2013\Menge\Core.obj     1           
Warning            LNK4098           defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library            MengeCore      c:\dev\Menge-master\projects\VS2013\Menge\LINK            1           
Warning            LNK4217           locally defined symbol _fprintf imported in function _png_default_error     MengeCore      c:\dev\Menge-master\projects\VS2013\Menge\libpng.lib(pngerror.obj)     1           
Error     LNK2001           unresolved external symbol __imp___snprintf           MengeCore              c:\dev\Menge-master\projects\VS2013\Menge\libpng.lib(png.obj)              1           
Error     LNK2001           unresolved external symbol __imp___snprintf           MengeCore              c:\dev\Menge-master\projects\VS2013\Menge\libpng.lib(pngwutil.obj)     1           
Error     LNK2019           unresolved external symbol __imp____iob_func referenced in function _png_default_error     MengeCore      c:\dev\Menge-master\projects\VS2013\Menge\libpng.lib(pngerror.obj)     1           
Error     LNK1120           2 unresolved externals             MengeCore              c:\dev\Menge-master\projects\VS2013\Menge\\build\lib\MengeCore_d.dll          1            
Warning            LNK4075           ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification              menge c:\dev\Menge-master\projects\VS2013\Menge\mengeMain.obj     1            
Warning            LNK4098           defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library            menge c:\dev\Menge-master\projects\VS2013\Menge\MSVCRTD.lib(initializers.obj)         1            
Error     LNK2019           unresolved external symbol ___iob_func referenced in function _ShowError      menge c:\dev\Menge-master\projects\VS2013\Menge\SDLmain.lib(SDL_win32_main.obj)           1           
Error     LNK1120           1 unresolved externals             menge c:\dev\Menge-master\Exe\menge.exe            1            
curds01 commented 7 years ago

Libpng certainly seems to be the culprit. I won't be able to get to this until this evening/afternoon (Pacific Coast Time). If you have a chance to play with it now, I'd appreciate hearing how it goes.

JimSEOW commented 7 years ago

can someone replace the not working Libpng libs with working ones. I am compiling x64.

curds01 commented 7 years ago

I've got a work in progress here: https://github.com/curds01/Menge/tree/vs2015

I've been able to build and run with a 32-bit build. I don't quite have a 64-bit build running. I have to handle 64-bit SDL (that may require moving from SDL 1.2 to SDL 2.0).