Compiling error Win7, VS19 [1. time attempt]

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
TheNewGuy
Engineer
Engineer
Posts: 4
Joined: 23 Apr 2018 14:25

Compiling error Win7, VS19 [1. time attempt]

Post by TheNewGuy » 01 Aug 2019 12:20

Hey.

I normally do not work with Visual Studio (19) nor C/C++ for a while. Anyways, I wanted to compile (duh) ottd. I followed the howto (https://github.com/OpenTTD/OpenTTD/blob ... ws_MSVC.md) resolved dependencies etc.etc..

Following error occurs which let the build fail: C2338
Windows headers require the default packing option. Changing this can lead to memory corruption. This diagnostic can be disabled by building with WINDOWS_IGNORE_PACKING_MISMATCH defined.
1. Does anyone experienced this as well and knows where it comes from?
2. Can anyone tell me how to resolve that? (I do not even know how I define the WINDOWS_IGNORE_PACKING_MISMATCH?!)

Any help would be great!

Thanks a lot for your work!!

User avatar
jfs
Director
Director
Posts: 583
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Compiling error Win7, VS19 [1. time attempt]

Post by jfs » 01 Aug 2019 15:08

I have never seen that error before, doesn't happen for me using VS 2019.
Can you post more of your compile output? Importantly which files it's compiling when it happens.

TheNewGuy
Engineer
Engineer
Posts: 4
Joined: 23 Apr 2018 14:25

Re: Compiling error Win7, VS19 [1. time attempt]

Post by TheNewGuy » 01 Aug 2019 17:03

Ouh hi. Nice. Thanks for the response.
Let's dig into it.

A couple more details if that is a very uncommon error.
I open: openttd_vs142.sln

Then I go: Build -> Build Solution (not build openttd? right? Either way, the result is identical)

And I spare you the whole output as it literally(!) is:
Severity Code Description Project File Line Suppression State
Error C2338 Windows headers require the default packing option. Changing this can lead to memory corruption. This diagnostic can be disabled by building with WINDOWS_IGNORE_PACKING_MISMATCH defined. (compiling source file ..\src\date.cpp) openttd G:\Windows Kits\10\Include\10.0.18362.0\um\winnt.h 2482
80 times over and over again. Files: date.cpp, console.cpp, console_cmds.cpp, ...

The only more or less kinda related stuff I found to this topic was:
https://stackoverflow.com/questions/293 ... ck-warning
https://stackoverflow.com/questions/565 ... ing-option

Regarding the second link, when I head to Project -> Properties -> C/C++ -> Command Line in "Additional Options" is: "/J /Zc:throwingNew /std:c++latest ".
However, removing '/Zc:throwingNew' didn't change any of the observed behavior. As I never use an IDE I am really digging in the dark and was hoping that someone has a direct solution to it.

Anyways. Thanks a lot for the help!

p.s. Clicking the error message leads to:
winnt.h

Code: Select all

2482 static_assert(__alignof(LARGE_INTEGER) == 8, "Windows headers require the default packing option. Changing this can lead to memory corruption."
2483    " This diagnostic can be disabled by building with WINDOWS_IGNORE_PACKING_MISMATCH defined.");
p.p.s The only thing bothering me is: In the tutorial there is stated:
Set the build mode to Release in Build > Configuration manager > Active solution configuration. You can now compile.
There was no "Release" mode in the menu? So I manually added it? But that doesn't feel right?

User avatar
jfs
Director
Director
Posts: 583
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Compiling error Win7, VS19 [1. time attempt]

Post by jfs » 01 Aug 2019 17:34

Try first resetting any changes to the project files to the checkout state.
Set the build configuration in the dropdowns in the toolbar (those saying Debug, x64 on my screenshot). I recommend building Debug first, since it tends to build faster. Generally only bother building the bitness-version (Win32 or x64) that matches your CPU.
I build by right-clicking the openttd project (shown in bold) and choosing Build. Not Build Solution. The openttd project is set to depend on all the others, so they will build in the correct order automatically.
Attachments
devenv_2019-08-01_19-30-02.png
devenv_2019-08-01_19-30-02.png (58.7 KiB) Viewed 613 times

TheNewGuy
Engineer
Engineer
Posts: 4
Joined: 23 Apr 2018 14:25

Re: Compiling error Win7, VS19 [1. time attempt]

Post by TheNewGuy » 01 Aug 2019 18:15

Omg! Thanks a lot!!
I don't know what did the trick (I would almost assume the "right click on the openttd and build).
But I was able to compile it and after downloading the opengfx also to start the game.

Thanks a lot! Now on to the adventure of adding stuff I think might be (also ^^) fun in the game! *g ;) :)

p.s. Please keep this thread here. If anyone else stumbles over the the same problem he/she will find the solution here.

Thanks again!

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 8 guests