Author Topic: [HELP] Compiling under Visual Studio 2015  (Read 11787 times)

Offline psyHoTik

  • Sergeant
  • **
  • Posts: 38
    • View Profile
[HELP] Compiling under Visual Studio 2015
« on: March 14, 2016, 10:09:48 pm »
Hello! Could you please help me with compiling OXC under MVS Community 2015? I've followed this walkthrough, but I'm getting following errors/ warnings:
Code: [Select]
Severity Code Description Project File Line Suppression State
Warning C4091 'typedef ': ignored on left of '' when no variable is declared (compiling source file Engine\CrossPlatform.cpp) OpenXcom C:\Program Files\Windows Kits\8.1\Include\um\dbghelp.h 3190
Warning C4091 'typedef ': ignored on left of '' when no variable is declared (compiling source file Engine\CrossPlatform.cpp) OpenXcom C:\Program Files\Windows Kits\8.1\Include\um\dbghelp.h 1544
Error LNK1120 1 unresolved externals OpenXcom C:\Users\Tomek\Desktop\OXC\OpenXcom\bin\Win32\Debug\OpenXcom.exe 1
Warning LNK4098 defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library OpenXcom C:\Users\Tomek\Desktop\OXC\OpenXcom\src\MSVCRTD.lib(initializers.obj) 1
Warning LNK4217 locally defined symbol _fprintf imported in function _ShowError OpenXcom C:\Users\Tomek\Desktop\OXC\OpenXcom\src\SDLmain.lib(SDL_win32_main.obj) 1
Error LNK2019 unresolved external symbol __imp____iob_func referenced in function _ShowError OpenXcom C:\Users\Tomek\Desktop\OXC\OpenXcom\src\SDLmain.lib(SDL_win32_main.obj) 1

I also get many "Unknown compiler version - please run the configure tests and report the results" messages.

Any suggestions? :) Please have mercy as this is the first time I compile something for Windows :)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #1 on: March 14, 2016, 10:49:43 pm »
The walkthrough on UFOpedia is for vs2010 and vs2013.

For vs2015, you will need new precompiled dependencies.
You can make your own (good luck with that)... or use mine: https://openxcom.org/forum/index.php/topic,3937.msg56803.html#msg56803

PS: There are no official precompiled dependencies for vs2015 yet... as far as I know.

Offline psyHoTik

  • Sergeant
  • **
  • Posts: 38
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #2 on: March 14, 2016, 10:59:06 pm »
Thank you very much :) I'll try that.

Offline psyHoTik

  • Sergeant
  • **
  • Posts: 38
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #3 on: March 15, 2016, 07:33:16 pm »
OK, I've used your vs2015 deps and YAML_CPP_DLL definition and I got a successful build (again big thanks for help) but the game is not starting. I get the following error:
Code: [Select]
[15-03-2016 18:18:21] [INFO] Data folder is:
[15-03-2016 18:18:21] [INFO] Data search is:
[15-03-2016 18:18:21] [INFO] - C:\Users\Tomek\Documents\OpenXcom\
[15-03-2016 18:18:21] [INFO] - C:\Users\Tomek\Desktop\OXC\OpenXcom\bin\Win32\Debug
[15-03-2016 18:18:21] [INFO] - C:\Users\Tomek\Desktop\OXC\OpenXcom\bin\Win32\Debug
[15-03-2016 18:18:21] [INFO] User folder is: C:\Users\Tomek\Documents\OpenXcom\
[15-03-2016 18:18:21] [INFO] Config folder is: C:\Users\Tomek\Documents\OpenXcom\
[15-03-2016 18:18:21] [INFO] Options loaded successfully.
[15-03-2016 18:18:21] [INFO] SDL initialized successfully.
[15-03-2016 18:18:22] [INFO] SDL_mixer initialized successfully.
[15-03-2016 18:18:22] [INFO] Attempting to set display to 640x400x8...
[15-03-2016 18:18:22] [INFO] Display set to 640x400x8.
[15-03-2016 18:18:22] [INFO] Loading data...
[15-03-2016 18:18:22] [INFO] Scanning standard mods in 'standard'...
[15-03-2016 18:18:22] [ERROR] bad file
[15-03-2016 18:18:35] [FATAL] A fatal error has occurred: code 0xc0000005
[15-03-2016 18:18:35] [FATAL] 0x50e9c0 std::_Tree<std::_Tmap_traits<YAML::detail::node *,YAML::detail::node *,std::less<YAML::detail::node *>,std::allocator<std::pair<YAML::detail::node * const,YAML::detail::node *> >,0> >::begin (xtree:1147)
[15-03-2016 18:18:35] [FATAL] 0x5024b0 YAML::detail::node_data::get<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > (impl.h:118)
[15-03-2016 18:18:35] [FATAL] 0x502c20 YAML::detail::node_ref::get<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > (node_ref.h:68)
[15-03-2016 18:18:35] [FATAL] 0x5022f0 YAML::detail::node::get<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > (node.h:129)
[15-03-2016 18:18:35] [FATAL] 0x6a6a50 YAML::Node::operator[]<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > (impl.h:390)
[15-03-2016 18:18:35] [FATAL] 0x6a5ff0 OpenXcom::OptionInfo::save (optioninfo.cpp:157)
[15-03-2016 18:18:35] [FATAL] 0x6b1a50 OpenXcom::Options::save (options.cpp:945)
[15-03-2016 18:18:35] [FATAL] 0x6626a0 OpenXcom::Game::run (game.cpp:313)
[15-03-2016 18:18:35] [FATAL] 0x82fa60 SDL_main (main.cpp:116)
[15-03-2016 18:18:35] [FATAL] 0xb80210 main (SymGetLineFromAddr64 failed: 487)
[15-03-2016 18:18:35] [FATAL] 0xb7e300 invoke_main (exe_common.inl:74)
[15-03-2016 18:18:35] [FATAL] 0xb7e010 __scrt_common_main_seh (exe_common.inl:264)
[15-03-2016 18:18:35] [FATAL] 0xb7dff0 __scrt_common_main (exe_common.inl:309)
[15-03-2016 18:18:35] [FATAL] 0xb7e330 mainCRTStartup (exe_main.cpp:17)
[15-03-2016 18:18:35] [FATAL] 0x76f7ef0a BaseThreadInitThunk (SymGetLineFromAddr64 failed: 487)
[15-03-2016 18:18:35] [FATAL] 0x76e23a64 RtlInitializeExceptionChain (SymGetLineFromAddr64 failed: 487)
[15-03-2016 18:18:35] [FATAL] 0x76e23a64 RtlInitializeExceptionChain (SymGetLineFromAddr64 failed: 487)
[15-03-2016 18:18:35] [FATAL] Crash dump generated at C:\Users\Tomek\Documents\OpenXcom\15-03-2016_18-18-35.dmp
[15-03-2016 18:18:53] [FATAL] OpenXcom has crashed: code 0xc0000005
Extra information has been saved to openxcom.log.
Please report this to the developers.


I haven't tried the #include <algorithm> thing as there were no errors at building...
« Last Edit: March 15, 2016, 08:58:45 pm by psyHoTik »

Offline harre

  • Sergeant
  • **
  • Posts: 45
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #4 on: March 15, 2016, 10:47:30 pm »
the includes needed for the new yaml-cpp dependancy is pulled from my fork.

you get same problem as me, it's seem to be some issues when running in debug-mode. I havn't figured out what is going wrong. Try a release-build instead.

Offline psyHoTik

  • Sergeant
  • **
  • Posts: 38
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #5 on: March 15, 2016, 11:39:54 pm »
Building a release failed  :-[ I got a lot of warnings about possible loss of data due to conversion and 2 errors:
Code: [Select]
Severity Code Description Project File Line Suppression State
Error LNK1120 1 unresolved externals OpenXcom C:\Users\Tomek\Desktop\OXC\OpenXcom\bin\Win32\Release\OpenXcom.exe 1
Error LNK2001 unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > YAML::detail::node_data::empty_scalar" (?empty_scalar@node_data@detail@YAML@@2V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) OpenXcom C:\Users\Tomek\Desktop\OXC\OpenXcom\src\AlienBAIState.obj 1
I tried to disable optimization but it didn't change anything...

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #6 on: March 16, 2016, 12:35:48 am »
Building a release failed  :-[ I got a lot of warnings about possible loss of data due to conversion and 2 errors:
Code: [Select]
Severity Code Description Project File Line Suppression State
Error LNK1120 1 unresolved externals OpenXcom C:\Users\Tomek\Desktop\OXC\OpenXcom\bin\Win32\Release\OpenXcom.exe 1
Error LNK2001 unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > YAML::detail::node_data::empty_scalar" (?empty_scalar@node_data@detail@YAML@@2V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) OpenXcom C:\Users\Tomek\Desktop\OXC\OpenXcom\src\AlienBAIState.obj 1
I tried to disable optimization but it didn't change anything...
Do you link all required files from yaml lib? This error expecting to have static variable `YAML::detail::node_data::empty_scalar` of type `std::string` defined somewhere.

Offline psyHoTik

  • Sergeant
  • **
  • Posts: 38
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #7 on: March 16, 2016, 09:15:27 pm »
Do you link all required files from yaml lib? This error expecting to have static variable `YAML::detail::node_data::empty_scalar` of type `std::string` defined somewhere.
The truth is... I don't know  :-[ I just followed the walkthrough from Ufopaedia, only difference is that I used Meridian dependencies for vs2015 and I add "YAML_CPP_DLL" preprocessor definition (also suggested by Meridian). I haven't modified the code yet. The effect is:
1. In Debug mode building is successful (no errors, no warnings) but the game crashes on start
2. In Release mode building fails - 2 errors (described above) and about 180 warnings, mostly "conversion - possible loss of data"

That's all I know for now. Like I said in different thread, I'm not a real programmer - I just wanted to experiment a little with AI code (I have some C++ knowledge) and hoped that build can be made with some tutorial, without going into too much details. It seems it's not that easy :(

How can I check if this whole YAML-thing is linked correctly? :)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #8 on: March 16, 2016, 09:34:57 pm »
Then you probably use wrong yaml version. Meridian use newer one than in normal OXC. This is way you don't get this errors with `<algorithms>`.
Old one include lot of different headers (like from boost library). New one only that they need. In consequence some files in OXC depend on headers included by yaml and after upgrade its break build of OXC.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #9 on: March 16, 2016, 10:44:53 pm »
He uses my precompiled version of YAML... which is probably incorrectly compiled... I can't make debug version work on my machine. But the release version works fine for me. I told you, use at own risk  :(

Also.... he is not getting the <algorithm> errors, because the includes were added into latest nightlies just a week ago: https://github.com/SupSuper/OpenXcom/commit/0b91559b9a61fcefa906558d939c10092ab2f624

... just for explanation. Unfortunately I cannot help you with your actual issue, because I know too little about this myself. But I have installed VirtualBox today and will install probably Ubuntu over the weekend... maybe compilation under Linux won't be as much pain as it is under vs2015.

EDIT: btw. did you add YAML_CPP_DLL also for Release mode? Maybe you added it only for Debug build.... that might be the cause...
« Last Edit: March 16, 2016, 10:50:37 pm by Meridian »

Offline harre

  • Sergeant
  • **
  • Posts: 45
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #10 on: March 17, 2016, 02:15:59 am »
I have build release-mode succesfully with Meridan's dependancies, I think as he says that you probably forgot to add the YAML_CPP_DLL preprocessor directive.

Try checkout this fork, it should be just building with no modifications after downloading Meridan's depencancies.

https://github.com/hartmark/OpenXcom/tree/vs2015

Offline psyHoTik

  • Sergeant
  • **
  • Posts: 38
    • View Profile
Re: [HELP] Compiling under Visual Studio 2015
« Reply #11 on: March 17, 2016, 08:18:47 pm »
EDIT: btw. did you add YAML_CPP_DLL also for Release mode? Maybe you added it only for Debug build.... that might be the cause...
Exactly, that was the case :) I didn't know that this is separate for debug and release. The code compiled successfully (although with 3991 warnings ;) ) and the game runs.

Try checkout this fork, it should be just building with no modifications after downloading Meridan's depencancies.
https://github.com/hartmark/OpenXcom/tree/vs2015
Thanks, I'll have that in mind in case some other issues come up.

Again big thanks for all of you, guys.