TheRealMJP / BakingLab

A D3D11 application for experimenting with Spherical Gaussian lightmaps
MIT License
700 stars 91 forks source link

Compiling for older platform toolsets #1

Closed ChaosCom closed 8 years ago

ChaosCom commented 8 years ago

Would it be possible for you modify the code that it's compilable with older Visual Studio editions? When I set the Platform Toolset to v120 (VS 2013) and try go compile the BakingLab, i only get a handful of issues:

1>DirectXTex.lib(DirectXTexUtil.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(DirectXTexImage.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(DirectXTexDDS.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(DirectXTexWIC.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(DirectXTexD3D11.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(DirectXTexConvert.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(DirectXTexMipMaps.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(DirectXTexMipMaps.obj) : error LNK2005: "public: __cdecl std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QEAA@XZ) already defined in msvcprtd.lib(MSVCP120D.dll)
1>DirectXTex.lib(DirectXTexMipMaps.obj) : error LNK2005: "public: __cdecl std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QEAA@XZ) already defined in msvcprtd.lib(MSVCP120D.dll)
1>DirectXTex.lib(DirectXTexMipMaps.obj) : error LNK2005: "public: struct std::_Iterator_base12 * * __cdecl std::_Container_base12::_Getpfirst(void)const " (?_Getpfirst@_Container_base12@std@@QEBAPEAPEAU_Iterator_base12@2@XZ) already defined in msvcprtd.lib(MSVCP120D.dll)
1>DirectXTex.lib(DirectXTexMipMaps.obj) : error LNK2005: "public: void __cdecl std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QEAAXXZ) already defined in msvcprtd.lib(MSVCP120D.dll)
1>DirectXTex.lib(DirectXTexCompress.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(BC.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(BC4BC5.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(BC6HBC7.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1900' doesn't match value '1800' in App.obj
1>DirectXTex.lib(DirectXTexMipMaps.obj) : error LNK2001: unresolved external symbol __imp__invalid_parameter_noinfo
1>DirectXTex.lib(DirectXTexImage.obj) : error LNK2001: unresolved external symbol __imp__invalid_parameter_noinfo
1>DirectXTex.lib(DirectXTexDDS.obj) : error LNK2001: unresolved external symbol __imp__invalid_parameter_noinfo
1>DirectXTex.lib(DirectXTexD3D11.obj) : error LNK2001: unresolved external symbol __imp__invalid_parameter_noinfo
1>DirectXTex.lib(DirectXTexConvert.obj) : error LNK2001: unresolved external symbol __imp__invalid_parameter_noinfo
1>DirectXTex.lib(DirectXTexMipMaps.obj) : error LNK2019: unresolved external symbol "void __cdecl `eh vector constructor iterator'(void *,unsigned __int64,unsigned __int64,void (__cdecl*)(void *),void (__cdecl*)(void *))" (??_L@YAXPEAX_K1P6AX0@Z2@Z) referenced in function "long __cdecl DirectX::_Generate2DMipsTriangleFilter(unsigned __int64,unsigned long,class DirectX::ScratchImage const &,unsigned __int64)" (?_Generate2DMipsTriangleFilter@DirectX@@YAJ_KKAEBVScratchImage@1@0@Z)
1>DirectXTex.lib(DirectXTexMipMaps.obj) : error LNK2019: unresolved external symbol "void __cdecl `eh vector destructor iterator'(void *,unsigned __int64,unsigned __int64,void (__cdecl*)(void *))" (??_M@YAXPEAX_K1P6AX0@Z@Z) referenced in function "public: void * __cdecl DirectX::TriangleFilter::TriangleRow::`vector deleting destructor'(unsigned int)" (??_ETriangleRow@TriangleFilter@DirectX@@QEAAPEAXI@Z)
1>DirectXTex.lib(DirectXTexMipMaps.obj) : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z) referenced in function "public: void __cdecl std::default_delete<struct DirectX::TriangleFilter::Filter>::operator()(struct DirectX::TriangleFilter::Filter *)const " (??R?$default_delete@UFilter@TriangleFilter@DirectX@@@std@@QEBAXPEAUFilter@TriangleFilter@DirectX@@@Z)
1>DirectXTex.lib(DirectXTexMipMaps.obj) : error LNK2019: unresolved external symbol "void __cdecl operator delete[](void *,unsigned __int64)" (??_V@YAXPEAX_K@Z) referenced in function "public: void * __cdecl DirectX::TriangleFilter::TriangleRow::`vector deleting destructor'(unsigned int)" (??_ETriangleRow@TriangleFilter@DirectX@@QEAAPEAXI@Z)
1>X:\BakingLab-master\BakingLab\Debug\x64\BakingLab.exe : fatal error LNK1120: 5 unresolved externals
1>
1>Build FAILED.
1>

If I understand correctly, since most of this looks like it's coming from DirectXTex.lib, recompiling DirectXTex with Platform Toolset v120 would possibly be all that is required.

This would allow for a broader range of people interested in this project to tinker with the code, and should not hinder VS 2015 users in any way.

TheRealMJP commented 8 years ago

Yeah, it should be pretty easy to set up 2013 project. Unfortunately I don't have VS 2013 installed on my home PC, so I'll either need to install it or wait until Monday to do it on my work PC.

ChaosCom commented 8 years ago

Thanks for the update, though I'll admit i haven't checked it out yet because I managed to get it to compile on VS 2013 by myself doing the following:

1- Downloading the Dec 2013 version of DirectXTex https://github.com/Microsoft/DirectXTex/tags?after=jan2014 and compiling it on v120.

This was not enough for a successful compile though. I got a weird

3>  PostProcessor.cpp
3>  SG.cpp
3>LINK : fatal error C1900: Il mismatch between 'P1' version '20130802' and 'P2' version '20100826'
3>LINK : fatal error LNK1257: code generation failed
3>
3>Build FAILED.

that sent me on a wild goose chase until I discovered that it was the 2015 version of the HosekSky.lib library that was causing this error (though I have no idea what and where the "20100826" date is coming from" - it would be interesting to know though, because the common response for error C1900 that it's an linker issue that's fixed either by removing "Whole Program Optimization" in the compiler or "/LTCG" in the linker or by installing Service Packs for VS does not seem to apply anymore.

Fortunately for me the HosekSky folder already had a 2013 version of the lib so

2-Swapping the HosekSky lib version 2015 out for the 2013 version

resulted in a successful build.

The HosekSky folder has an include folder that looks like the whole HosekSky library, is that correct ? Because if that is the case, maybe dropping the lib and directly including the source files (e.g. under an "Externals" subfolder or something) would possibly get rid of the potential linker shenanigans that I described above. (The same reasoning could also be applied to all the other external libs)