Author Topic: Windows 10 and Visual Studio 2015  (Read 21660 times)

0 Members and 1 Guest are viewing this topic.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4807
  • Total likes: 191
  • Helpful: 108
  • Languages: EN, NO
Re: Windows 10 and Visual Studio 2015
« Reply #70 on: August 23, 2015, 06:07:12 PM »
In MSVC2015 at least, you can exclude a file from the build for particular configurations and platforms. Does anybody know if this is the right way of doing it? It's sort of similar to how CodeBlocks does it, except that it has the inverse property (and also doesn't hold platform distinct from configuration).

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15691
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Windows 10 and Visual Studio 2015
« Reply #71 on: August 23, 2015, 06:13:56 PM »
Can this be done in MSVS 2012?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Online DrSuperGood

Re: Windows 10 and Visual Studio 2015
« Reply #72 on: August 23, 2015, 08:37:49 PM »
Quote
Are you aware of any way (apart from #ifdef directives in the files themselves) to tell MSVS which files to try to build separately for each build configuration?
You can exclude specific files from particular builds by right clicking them and modifying their properties.

I am not sure if this is the "right" way to do it. Looking at how zlib did it, you could make separate projects (whatever they are called) which specify the build configuration and then in those separate projects you have standard configurations like "debug", "Release", "Release (64)" etc.

Currently I have the messy approach of various builds like SDL2, SDL2 Debug, POSIX etc in one project. From a configuration point of view having separate projects (maybe they are sub-projects?) for things like GDI, POSIX, SDL, SDL2 etc each linking to different libraries and C++ files and then each of those has separate standard configurations (debug and release for 32 and 64).

The configurations with different C++ source files is supported in community 2013 and 2015. I am unsure of 2012. I would recommend upgrading to Community 2015 since it is completely free and suitable for even small scale commercial operations. However depending on what else you use it for (eg work) that might not be applicable.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15691
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Windows 10 and Visual Studio 2015
« Reply #73 on: August 23, 2015, 09:29:02 PM »
Thank you: that is very helpful. It does work in 2012. Would one then disable simsys_w for the command line server build?

Do you know whether your updated posix file is compatible with Experimental running on Linux? I know so little of the workings of the low level stuff that it will be very difficult for me to work out what the problem is if it is not (and a release is so far away that I may have forgotten this change by the time that I come to compile for Linux, making any problems very hard to track down).

Upgrading to the 2015 version may well be worthwhile if there are reasonable straightforward ways of fixing the issues, as you have outlined. I do not use MSVS for anything other than Simutrans: my work is entirely unconnected with programming (and I am entirely self taught, which is why I am hazy on the low level details in many cases).
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Online DrSuperGood

Re: Windows 10 and Visual Studio 2015
« Reply #74 on: August 23, 2015, 11:04:54 PM »
Quote
Thank you: that is very helpful. It does work in 2012. Would one then disable simsys_w for the command line server build?
You disable simsys_w and enable the posix one. I also think you need to change the graphic back end, I forget if that was for SDL2 or not.

Quote
Do you know whether your updated posix file is compatible with Experimental running on Linux?
Unless someone altered that file for experimental, or not all patches to it have been applied to experimental I see no reason for it to not work. The patches I made only alter the file behaviour when building targeting Windows, the file was not changed for Linux in any way.

Quote
Upgrading to the 2015 version may well be worthwhile if there are reasonable straightforward ways of fixing the issues, as you have outlined. I do not use MSVS for anything other than Simutrans: my work is entirely unconnected with programming (and I am entirely self taught, which is why I am hazy on the low level details in many cases).
I am slowly looking into constructing some form updated MSVC project file for standard. The problem is how to structure it in a nice, user friendly and maintainable way. Hopefully the same principles could be applied to experimental.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4807
  • Total likes: 191
  • Helpful: 108
  • Languages: EN, NO
Re: Windows 10 and Visual Studio 2015
« Reply #75 on: August 24, 2015, 05:25:06 AM »
You disable simsys_w and enable the posix one. I also think you need to change the graphic back end, I forget if that was for SDL2 or not.

simsys_* is the graphics back end. simgraph, which is the middle layer, shouldn't care for SDL2 or otherwise.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15691
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Windows 10 and Visual Studio 2015
« Reply #76 on: September 24, 2016, 12:46:46 AM »
I should note that I am just in the process of upgrading to Visual Studio 2015 now so that I can undertake some profiling, and I note that Visual Studio 2015 compatible library files can be obtained from the Open TTD website here.

Edit: However, I cannot find compatible versions of bzip anywhere - can anyone assist with that? I currently get linker errors (unresolved external symbol __iob_func referenced in function _bzopen_or_bzdopen)
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Online DrSuperGood

Re: Windows 10 and Visual Studio 2015
« Reply #77 on: September 24, 2016, 05:10:26 AM »
Quote
and I note that Visual Studio 2015 compatible library files can be obtained from the Open TTD website here.
Or you could just build them yourself, which is what I did. All the dependent libraries for standard come with MSVC projects which just need some minor modifications for compatibility/optimization.

Quote
However, I cannot find compatible versions of bzip anywhere - can anyone assist with that?
I have self-built versions which I use to statically link with standard.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15691
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Windows 10 and Visual Studio 2015
« Reply #78 on: September 24, 2016, 07:21:39 AM »
Were you able to build them from the source tarball on the official bzip website? I had trouble opening that.
« Last Edit: September 24, 2016, 10:14:02 AM by jamespetts »
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Online DrSuperGood

Re: Windows 10 and Visual Studio 2015
« Reply #79 on: September 24, 2016, 01:26:38 PM »
Quote
Were you able to build them from the source tarball on the official bzip website? I had trouble opening that.
Yes I was. Start by extracting bzip2-1.0.6 folder using 7-zip. Since it is a tar.gz (nested compression) this means using 7-zip's file explorer to first open the gz file and then the tar file to reveal the required folder. Inside that folder open libbz2.dsp with MSVC2015 and one-way upgrade it to MSVC2015.

Since the project is very old one has to hack around at the build properties. For example change Configuration Type from .dll to .lib so that it can be statically linked (less messy, 1 fewer dll to distribute). Whole program optimization should be turned on to fast link time code generation (very important for optimization), multi-processor compilation and runtime library must be the same as Simutrans. After that build and it should be usable when placed on the library path. If you still get errors when trying to link it with Simutrans then maybe some of the settings are conflicting between the projects such as exception and calling conventions.

Offline Ves

Windows 10 and Visual Studio 2015
« Reply #80 on: September 24, 2016, 04:12:37 PM »
I think i remember using the version 3.1 of the openTTD files.
I use windows 10 and msvs2015

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15691
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Windows 10 and Visual Studio 2015
« Reply #81 on: September 25, 2016, 09:26:26 PM »
Excellent, that worked for me, thank you!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Rollmaterial

Re: Windows 10 and Visual Studio 2015
« Reply #82 on: September 28, 2016, 04:05:28 PM »
I get this error when trying to compile bzlib:
Code: [Select]
Error D8016 '/ZI' and '/GL' command-line options are incompatible

Edit: I seem to have fixed that by compiling in release configuration. Now I'm having trouble with zlibstat from OpenTTD-useful-6.0.
« Last Edit: September 28, 2016, 04:24:49 PM by Rollmaterial »

Offline Ves

Re: Windows 10 and Visual Studio 2015
« Reply #83 on: September 28, 2016, 04:42:16 PM »
After james updated the experimental enviroment to mvsv2015 I get this error when trying to compile simutrans experimental:

Code: [Select]
Severity Code Description Project File Line Suppression State
Error C2011 'timespec': 'struct' type redefinition Simutrans-Experimental C:\Users\Victor\Documents\GitHub\OpenTTD\shared\include\pthread.h 320

His reply was that I should recompile the bzlib.
I have no problem compiling the bzlib uing the instructions in this thread, resulting in the file libbz2.lib, and I am replacing the existing one in the open TTD-files. I also modified the preferences to match the ones in experimtal and all the values DrSupergood suggested are matching.
However, experimental will still not compile, just throwing the same error again. Do any of you know what I might have been doing wrong?
Needless to say maybe, but I am running windows 10 msvs 2015


Quote
Now I'm having trouble with zlibstat from OpenTTD-useful-6.0.
I dont know if all this has changed now, but try the 3.1 one. It was the latest one I could get to work before.

Offline Rollmaterial

Re: Windows 10 and Visual Studio 2015
« Reply #84 on: September 28, 2016, 05:16:20 PM »
Turns out I just forgot to add some directories. Now I'm getting something else:
Code: [Select]
Severity Code Description Project File Line Suppression State
Error C1047 The object or library file '.\intermediates\release\simdepot.obj' was created with an older compiler than other objects; rebuild old objects and libraries

Online DrSuperGood

Re: Windows 10 and Visual Studio 2015
« Reply #85 on: September 28, 2016, 06:30:56 PM »
Quote

Edit: I seem to have fixed that by compiling in release configuration. Now I'm having trouble with zlibstat from OpenTTD-useful-6.0.
Custom build all dependencies and make sure they are built with compatible settings. That error is the result of an incompatible library.

Quote
After james updated the experimental enviroment to mvsv2015 I get this error when trying to compile simutrans experimental:
The current MSVC version of pthread is incompatible with modern MSVC2015 due to it declaring its own timespec structure which already exists in MSVC2015 as it is part of standard C++. It was solved in Simutrans standard long ago but the patch must not have made its way to experimental.

Code: [Select]

#if defined _MSC_VER && _MSC_VER >= 1900
// MSVC 2015 with Windows 10 SDK has struct timespec
#define _TIMESPEC_DEFINED
#endif

Quote
Turns out I just forgot to add some directories. Now I'm getting something else:
You will manually need to build the dependencies as they were built with an incompatible or old version of MSVC.
« Last Edit: September 28, 2016, 07:04:01 PM by DrSuperGood »

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15691
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Windows 10 and Visual Studio 2015
« Reply #86 on: September 28, 2016, 07:38:32 PM »
Turns out I just forgot to add some directories. Now I'm getting something else:
Code: [Select]
Severity Code Description Project File Line Suppression State
Error C1047 The object or library file '.\intermediates\release\simdepot.obj' was created with an older compiler than other objects; rebuild old objects and libraries

This looks as though you just need to clean the build before rebuilding, as the .obj files are temporary files created by the compiler whilst it is running.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Online DrSuperGood

Re: Windows 10 and Visual Studio 2015
« Reply #87 on: September 28, 2016, 08:34:20 PM »
Quote
This looks as though you just need to clean the build before rebuilding, as the .obj files are temporary files created by the compiler whilst it is running.
Yeh you are probably write. I just read the error and did not look at the path (ops). The same error is given if a library is used that was built with an old version of MSVC and was set for link time optimization.

Offline Ves

Re: Windows 10 and Visual Studio 2015
« Reply #88 on: October 02, 2016, 12:21:36 AM »
The current MSVC version of pthread is incompatible with modern MSVC2015 due to it declaring its own timespec structure which already exists in MSVC2015 as it is part of standard C++. It was solved in Simutrans standard long ago but the patch must not have made its way to experimental.

It appears as the experimental version was up to date, just with another set of comments, rearranging the lines. But that still unfortunately does not resolve the error.

Online DrSuperGood

Re: Windows 10 and Visual Studio 2015
« Reply #89 on: October 02, 2016, 01:23:32 AM »
Quote
It appears as the experimental version was up to date, just with another set of comments, rearranging the lines. But that still unfortunately does not resolve the error.
I cannot even find simthread.h in the experimental GitHub. Please link?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8795
  • Total likes: 319
  • Helpful: 229
  • Languages: De,EN,JP
Re: Windows 10 and Visual Studio 2015
« Reply #90 on: October 02, 2016, 07:12:45 AM »
I am not sure but at a certain point this discussion went far away from MS 2015 issues. Maybe open a specific experimental thread that might help to find the pthread discussion again if needed?

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15691
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Windows 10 and Visual Studio 2015
« Reply #91 on: October 02, 2016, 11:49:05 AM »
To answer Dr. Supergood's question, pthread.h is not on the Github repository as it is found in ~\Simutrans\OpenTTD\shared\include (i.e., it is an included file rather than one that is treated as part of the core code).

Is this distinct from Standard? Ves - is this the same arrangement as you have?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4807
  • Total likes: 191
  • Helpful: 108
  • Languages: EN, NO
Re: Windows 10 and Visual Studio 2015
« Reply #92 on: October 02, 2016, 12:15:25 PM »
To answer Dr. Supergood's question, pthread.h is not on the Github repository as it is found in ~\Simutrans\OpenTTD\shared\include (i.e., it is an included file rather than one that is treated as part of the core code).

DrSuperGood didn't ask for pthread.h, which as far as I know is part of a (system) library. simthread.h on the other hand, is part of Simutrans and Simutrans specific.

Online DrSuperGood

Re: Windows 10 and Visual Studio 2015
« Reply #93 on: October 02, 2016, 03:59:12 PM »
The fix for standard was to simthread.h (not pthread.h). All Simutrans thread functionality comes from that header, as opposed to directly importing pthread.h. Experimental does not appear to have a simthread.h file, which would be why there is no fix. Until the developers of pthread.h update their header file to be compatible with never versions of MSVC the only solution is to explicitly state, via definition, that the timespec struct already exists and the header is to not create it before one can import the header file. As simthread.h does this for standard that is where the fix was applied but apparently experimental does not have a simthread.h.

Offline Ves

Re: Windows 10 and Visual Studio 2015
« Reply #94 on: October 02, 2016, 08:06:01 PM »
I cannot even find simthread.h in the experimental GitHub. Please link?
Simthread.h is located here: https://github.com/jamespetts/simutrans-experimental/blob/devel-new-2/utils/simthread.h

Quote
I am not sure but at a certain point this discussion went far away from MS 2015 issues. Maybe open a specific experimental thread that might help to find the pthread discussion again if needed?
I am sorry if this is considered the wrong thread, I thought it is a windows 10/msvs2015 issue?

Quote
To answer Dr. Supergood's question, pthread.h is not on the Github repository as it is found in ~\Simutrans\OpenTTD\shared\include (i.e., it is an included file rather than one that is treated as part of the core code).

Is this distinct from Standard? Ves - is this the same arrangement as you have?
Yes I have that file there.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4807
  • Total likes: 191
  • Helpful: 108
  • Languages: EN, NO
Re: Windows 10 and Visual Studio 2015
« Reply #95 on: October 02, 2016, 08:46:53 PM »
I am sorry if this is considered the wrong thread, I thought it is a windows 10/msvs2015 issue?

I think the problem is that this thread was partially about experiences with Windows 10 mixed together with a MSVS2015 question. Now its just about MSVS2015, despite this being on a non-developer board. Anyone that might have come with Windows 10 feedback will likely be frightened by all the technical talk here. I suggest moving this discussion to one of the development boards. Then it can be a MSVS2015 discussion. What has been discussed lately has nothing to do with Windows 10.

Offline Ves

Re: Windows 10 and Visual Studio 2015
« Reply #96 on: October 02, 2016, 09:10:32 PM »
Quote
I think the problem is that this thread was partially about experiences with Windows 10 mixed together with a MSVS2015 question. Now its just about MSVS2015, despite this being on a non-developer board. Anyone that might have come with Windows 10 feedback will likely be frightened by all the technical talk here. I suggest moving this discussion to one of the development boards. Then it can be a MSVS2015 discussion. What has been discussed lately has nothing to do with Windows 10.

Ok, made a new thread here: http://forum.simutrans.com/index.php?topic=15783.0

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15691
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Windows 10 and Visual Studio 2015
« Reply #97 on: October 02, 2016, 09:21:01 PM »
Apologies: I misread the original post. simthread.h should be there in the ~/utils directory, which I believe is the default location: I certainly have not moved it.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.