OpenXcom Forum

OpenXcom => Troubleshooting => Topic started by: sylandro on August 31, 2015, 08:32:45 am

Title: Need help compiling under Windows/VS2015
Post by: sylandro on August 31, 2015, 08:32:45 am
I'm having problems compiling under Visual Studio 2015. I downloaded the dependencies from the wiki and added them to the deps folder, but I get the following error while the build process is linking:

Code: [Select]
Error LNK2001 unresolved external symbol __imp____iob_func OpenXcom G:\Documentos\Workspace\Git\openxcom\src\SDLmain.lib(SDL_win32_main.obj) 1
What am I doing wrong?
Title: Re: Need help compiling under Windows/VS2015
Post by: Warboy1982 on August 31, 2015, 10:58:00 am
the pre-compiled dependencies provided are for 2010 and 2013. you'll need to build your own for 2015.
Title: Re: Need help compiling under Windows/VS2015
Post by: SupSuper on August 31, 2015, 12:33:13 pm
VS2015 has some breaking C/C++ changes so you'll likely have to compile SDL yourself (https://www.gamedev.net/topic/664434-problem-installing-sdl-in-visual-studio-2015/)
Title: Re: Need help compiling under Windows/VS2015
Post by: sylandro on August 31, 2015, 04:31:34 pm
I thought so. I got confused because the Visual Studio link in the wiki redirects to the 2015 download link.

Thanks!
Title: Re: Need help compiling under Windows/VS2015
Post by: sylandro on September 06, 2015, 05:10:21 am
Ok, I switched to VS2010 express and now it builds, but whenever I try to run the application I get the following error:

Code: [Select]
Unhandled exception at 0x005986dc in OpenXcom.exe: 0xC0000005: Access violation reading location 0xabababab.
It breaks in the following line in impl.h:

Code: [Select]

for(node_map::const_iterator it=m_map.begin();it!=m_map.end();++it) {
if(equals(*it->first, key, pMemory))
return *it->second;
}

Any ideas why this might be happening?
Title: Re: Need help compiling under Windows/VS2015
Post by: Meridian on December 26, 2015, 11:42:54 am
** IMPORTANT: the linked files are provided as is, without any guarantee, use at your own risk! **

Hi all,

this was frikkin' complicated... but after many hours (and big help from my little brother!) I was able to compile OpenXcom in VS2015.

1/ the new precompiled dependencies (32bit, Release and Debug) can be downloaded here: openxcom-deps-win-vc2015-meridian.zip (https://drive.google.com/open?id=0B8itkFQbhj-YRV9QeGdLX0lhWjg) (2 MB)

2/ there was still a problem with compiling OpenXcom (same as here: https://github.com/jbeder/yaml-cpp/issues/332)

I solved it by adding "YAML_CPP_DLL" in OpenXcom project properties > Preprocessor definitions... there is probably a much better way to do it, but I leave that to SupSuper once he creates official dependencies and compilation instructions. See attached screenshot.

Enjoy!

Regards,
Meridian (and brother)

EDIT: versions used to compile dependencies:
  SDL: 1.2.15
  SDL_gfx: 2.0.25
  SDL_image: 1.2.12
  SDL_mixer: 1.2.12 (libmikmod: master from February 2016)
  yaml: master from 18th November 2016, doesn't need Boost anymore! requires C++11 though
Title: Re: Need help compiling under Windows/VS2015
Post by: Meridian on February 28, 2016, 05:09:31 pm
Updated previous post with new pre-compiled deps for vs2015.

Changes:
 - recompiled libmikmod ... old one was causing crashes
 - new yaml-cpp ... doesn't require boost now, but requires C++11
 - new yaml-cppd

PS: this time yaml-cppd is causing issues (debug mode only), but at least I can compile in release mode... will look at the debug later Debug works too now.
Title: Re: Need help compiling under Windows/VS2010
Post by: harre on March 01, 2016, 02:33:13 am
Thanks for the prebuilt dependancies, I tried to build the project but I got alot of std::min and std::max identifier not found.
Title: Re: Need help compiling under Windows/VS2015
Post by: Meridian on March 01, 2016, 09:18:22 am
Thanks for the prebuilt dependancies, I tried to build the project but I got alot of std::min and std::max identifier not found.

That's caused by the newest version of yaml-cpp, more info here: https://openxcom.org/forum/index.php/topic,4313.0.html
Just add the #include <algorithm> everywhere you see the error.
Title: Re: Need help compiling under Windows/VS2015
Post by: harre on March 03, 2016, 01:50:26 am
That's caused by the newest version of yaml-cpp, more info here: https://openxcom.org/forum/index.php/topic,4313.0.html
Just add the #include <algorithm> everywhere you see the error.

Cool, I got it compiled and running now. Thanks..

Now I need to get time to dig some in the code, I need to make a own fork and then I can make a pull request for the include fixes for yaml-cpp ;)
Title: Re: Need help compiling under Windows/VS2015
Post by: harre on March 04, 2016, 12:22:49 am
I have created a pull request for the changes.

https://github.com/SupSuper/OpenXcom/pull/1086
Title: Re: Need help compiling under Windows/VS2015
Post by: Meridian on November 20, 2016, 10:18:05 am
I have tried with the newest yaml-cpp and now Debug works for me too, yay!

Download of updated pre-compiled dependencies for Visual Studio 2015: https://drive.google.com/open?id=0B8itkFQbhj-YRV9QeGdLX0lhWjg
Title: Re: Need help compiling under Windows/VS2015
Post by: harre on November 22, 2016, 12:56:55 am
Cool, I'll try it out next year  8) Now I'm swamped at work and home with kids for the rest of the year
Title: Re: Need help compiling under Windows/VS2015
Post by: tylor on January 03, 2017, 09:57:50 pm
I have tried to compile https://github.com/MeridianOXC/OpenXcom/tree/oxce3.5-plus-proto with the deps you provided, and it worked perfectly. But only in Debug version. Release one could not find windows.h, gl.h and glu.h. Is it hard to fix it?
Title: Re: Need help compiling under Windows/VS2017
Post by: Meridian on March 08, 2017, 07:02:17 pm
1/ the new precompiled dependencies (32bit, Release and Debug) can be downloaded here: openxcom-deps-win-vc2015-meridian.zip (https://drive.google.com/open?id=0B8itkFQbhj-YRV9QeGdLX0lhWjg) (2 MB)

2/ there was still a problem with compiling OpenXcom (same as here: https://github.com/jbeder/yaml-cpp/issues/332)

I solved it by adding "YAML_CPP_DLL" in OpenXcom project properties > Preprocessor definitions... there is probably a much better way to do it, but I leave that to SupSuper once he creates official dependencies and compilation instructions. See attached screenshot.

EDIT: versions used to compile dependencies:
  SDL: 1.2.15
  SDL_gfx: 2.0.25
  SDL_image: 1.2.12
  SDL_mixer: 1.2.12 (libmikmod: master from February 2016)
  yaml: master from 18th November 2016, doesn't need Boost anymore! requires C++11 though

If anyone's interested, Visual Studio 2017 is out since yesterday and I've prepared the pre-compiled dependencies (32bit, Release and Debug):

  SDL: 1.2.15
  SDL_gfx: 2.0.25
  SDL_image: 1.2.12
  SDL_mixer: 1.2.12 (replaced libmikmod with v3.3.10 from August 2016)
  yaml: master from 8th March 2017 (0fdb1b9), doesn't need Boost anymore! requires C++11 though

Download: openxcom-deps-win-vc2017.zip (https://drive.google.com/open?id=0B8itkFQbhj-YOWk0dF9kTGhYOVk) (2 MB)
Title: Re: Need help compiling under Windows/VS2015
Post by: snicmtl on March 08, 2017, 09:05:38 pm
Nicely done Meridian!

I was working on this all night trying to wrap my head around it.

Got all the deps compiled but am/was hitting a wall with unresolved externals re: SDL

( ieError   LNK2001   unresolved external symbol _IID_IDirectDrawSurface3   OpenXcom   C:\dev\OpenXcom\src\SDL.lib(SDL_dx5yuv.obj)   1   
 )

I feel I'm so close, I'd love to complete the work without using the premade package.

Did you get anything similar?



PS: Love the cmake import in VS2017

Cheers,

snicmtl
Cheers,
Title: Re: Need help compiling under Windows/VS2017
Post by: Meridian on March 08, 2017, 09:40:35 pm
Did you get anything similar?

No, not really.
Actually, it all went extremely smooth for me... everything worked on the first try.
Title: Re: Need help compiling under Windows/VS2015
Post by: snicmtl on March 08, 2017, 10:10:17 pm
Thanks for the quick reply. It turns out it needed the DirectX libs/SDK.  Compiled great once that was intalled/pointed to .

Also, it now compiles without the YAML_DLL_CPP preprocessor directive that was needed with VS2015, though unsure if that is because I went ahead and compiled yaml itself, or just from the switch to VS2017.

Cheers!
Title: Re: Need help compiling under Windows/VS2015
Post by: MadHaTr on April 12, 2017, 08:45:23 am
I am warming back up by attempting to compile oxc(https://github.com/SupSuper/OpenXcom) in VSC++ 2017, I received the error which seems most common for builds in 2015 having to do with non updated deps.  Which sent me on a side adventure to compile the deps myself. Starting which YAML, I seem to have made a mistake.

I clone the git(https://github.com/jbeder/yaml-cpp) (I'm pretty new to git) I run cmake for VSC++ 2017, get my SLN file and compile in VS, everything works great but I don't get the yaml files I am after. I also don't get and DLL's.  This is the only LIB file received. (libyaml-cppmd.lib) which was 1.7MB, way larger than what I see you guys using so I know it is not just renamed.

What am I doing wrong when it comes to the yaml dll and lib.

Title: Re: Need help compiling under Windows/VS2017
Post by: Meridian on April 12, 2017, 10:16:48 am
What am I doing wrong when it comes to the yaml dll and lib.

Code: [Select]
mkdir sandbox
cd sandbox
git clone https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp
mkdir build
cd build
cmake -G"Visual Studio 15" -DBUILD_SHARED_LIBS=TRUE -DCMAKE_DEBUG_POSTFIX="d" ..

... then open visual studio 2017 solution and build both debug and release.
Title: Re: Need help compiling under Windows/VS2015
Post by: MadHaTr on April 12, 2017, 04:33:04 pm
I'll give this a try, seems the only thing that is different is I was not selecting the shared option.

Edit: Correction I did have the shared option selected.  Though I used windows cmake and it had 2 other options selected as well, maybe one of them messed it up or this -DCMAKE_DEBUG_POSTFIX="d" option made the difference.  I don't know. Worked the same as last time though now I have the yaml dll.

Thanks.  I'll move on to compiling the other deps now.

Edit2: Wanted to go back and try again with the windows cmake, and no I did not have the shared libs selected... hence no dlls.
Title: Re: Need help compiling under Windows/VS2015
Post by: Arbuckle on October 04, 2017, 10:35:12 pm
I've downloaded the latest openxcom extended sources and tried to compile them with VS2017 + the 2017 precompiled dependencies that Meridian posted here and got these errors:
Code: [Select]
1>AIModule.obj : 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)
1>Map.obj : error LNK2001: unresolved external symbol "public: void __thiscall OpenXcom::ItemSprite::drawShadow(class OpenXcom::BattleItem *,int,int,bool)" (?drawShadow@ItemSprite@OpenXcom@@QAEXPAVBattleItem@2@HH_N@Z)
1>Map.obj : error LNK2001: unresolved external symbol "public: void __thiscall OpenXcom::ItemSprite::draw(class OpenXcom::BattleItem *,int,int,int,bool)" (?draw@ItemSprite@OpenXcom@@QAEXPAVBattleItem@2@HHH_N@Z)
1>Map.obj : error LNK2001: unresolved external symbol "public: __thiscall OpenXcom::ItemSprite::~ItemSprite(void)" (??1ItemSprite@OpenXcom@@QAE@XZ)
1>Map.obj : error LNK2001: unresolved external symbol "public: __thiscall OpenXcom::ItemSprite::ItemSprite(class OpenXcom::Surface *,class OpenXcom::Mod *,int)" (??0ItemSprite@OpenXcom@@QAE@PAVSurface@1@PAVMod@1@H@Z)
1>C:\Users\username\Desktop\New Folder\OpenXcom-OpenXcomExtended\src\..\bin\Win32\Release\OpenXcom.exe : fatal error LNK1120: 5 unresolved externals

So I guessed that there might be a problem with my precompiled YAML dll, so I compiled both the 0.51 and the newest commit and tried both.  And I got the same errors.

Any ideas?
Title: Re: Need help compiling under Windows/VS2015
Post by: Meridian on October 04, 2017, 11:34:52 pm
Which commit exactly did you check out from the repo?

Just to confirm you have the correct repo, correct branch and correct commit :)
Title: Re: Need help compiling under Windows/VS2015
Post by: Arbuckle on October 05, 2017, 06:23:17 pm
Well shit, I dowloaded both masters from OXCE and OXCE+ just to make sure I had the masters and now they both compiled without any problems. Seems I didn't have the correct repo/branch/commit, thanks.
Title: Re: Need help compiling under Windows/VS2015
Post by: Meridian on October 05, 2017, 06:56:41 pm
Well shit, I dowloaded both masters from OXCE and OXCE+ just to make sure I had the masters and now they both compiled without any problems. Seems I didn't have the correct repo/branch/commit, thanks.

But the master branch of OXCE+ is identical with vanilla OpenXcom.

If you want the real thing, you need the "oxce3.5-plus-proto" branch...
Title: Re: Need help compiling under Windows/VS2017
Post by: davide on May 26, 2018, 07:42:51 pm
Hi Meridian,  after some years I wish I compile openxcom again...

I downloaded VS2017 community edition,
I cloned your github repo
I downloaded your dist of deps
I recompile it with some trouble about deps include/lib folders

There is a post with a tutorial about prepare a development image ?


Title: Re: Need help compiling under Windows/VS2017
Post by: Meridian on May 26, 2018, 09:11:34 pm
There is no specific post with such details.
VS2017 is enough, you don't need any other tools.
After cloning my repo, don't forget to switch to branch "oxce3.5-plus-proto" (i.e. not master)
You need to extract the dependencies into root directory, see attached screenshot.
After that just open the solution in VS and click Compile.
Title: Re: Need help compiling under Windows/VS2015
Post by: davide on May 26, 2018, 11:45:22 pm
Thanks, now I compiled without error.

I have some trouble with GIT ...

I tried to merge into your repo an old experiment of redv :
https://openxcom.org/forum/index.php/topic,3513.msg42933.html#msg42933 (https://openxcom.org/forum/index.php/topic,3513.msg42933.html#msg42933)
the source code in conceptually clear:
https://github.com/SupSuper/OpenXcom/compare/master...redv:active_base_defense (https://github.com/SupSuper/OpenXcom/compare/master...redv:active_base_defense)

... but today some file do not exist anymore ...or them were be renamed
Them are Ruleset/Ruleset.h,.cpp and Ruleset/RuleBaseFacility.h,.cpp
Title: Re: Need help compiling under Windows/VS2015
Post by: Meridian on May 27, 2018, 12:10:33 am
You don't seriously expect anything made in 2015 to merge without issues, do you?
Title: Re: Need help compiling under Windows/VS2015
Post by: davide on May 27, 2018, 12:16:10 am
of course you're right ::)
Title: Re: Need help compiling under Windows/VS2015
Post by: davide on May 27, 2018, 12:20:00 am
I found RuleBaseFacility in mod folder ... do you have any idea about position/new name of ruleset.h,.cpp ?
Title: Re: Need help compiling under Windows/VS2015
Post by: Meridian on May 27, 2018, 12:37:37 am
New name is Mod.h,.cpp
Title: Re: Need help compiling under Windows/VS2015
Post by: davide on May 27, 2018, 12:52:42 am
thanks
Title: Re: Need help compiling under Windows/VS2015
Post by: davide on June 02, 2018, 06:20:04 pm
I returns on this topic ... ::)

I merged redv's branch

but where is now #include "../Resource/ResourcePack.h" ?
Thanks
Title: Re: Need help compiling under Windows/VS2015
Post by: Meridian on June 02, 2018, 06:28:50 pm
No offense, but for such questions, you can just look into git history same as anyone else... nobody remembers stuff like that.

FWIW ResourcePack.h is now mostly inside Mod.h

Title: Re: Need help compiling under Windows/VS2015
Post by: davide on June 02, 2018, 09:05:03 pm
I apologize for the questions  :-[.. I do not have experience of GIT  :-\...


--- Posts merged ---

Thanks to your help I managed to recompile without errors
 :)
May I put user/mods folder into development folder ?
I tried at the same level of UFO folder, into bin but it was not loaded