-1

I have written some code that compiles on godbolt, but does not compile in Microsoft Visual Studio. I am trying to figure out why. My first step was to compare compiler versions. On goldbolt, I am compiling the code using "x64 msvc v19.latest." I googled "how to check msvc version," and all of the directions I can find lead me to the MSVS version, which is 17.2.6.

How can I find my MSVC version that is comparable to the godbolt version?

Mark Wallace
  • 528
  • 2
  • 12
  • It [compiles fine here](https://www.godbolt.org/z/3GnM6eGTx). You are probably using invalid command-line options for MSVC. – PaulMcKenzie Aug 07 '22 at 02:18
  • @PaulMcKenzie my link just leads to goldbolt.org. There is no code included in the question. – Mark Wallace Aug 07 '22 at 02:21
  • Please post the code. For example, this: `int size = 10; int arr[size];` will also compile using g++, but will fail to compile with MSVC, with the reason being that the code is not valid C++, but g++ accepts the non-standard VLA syntax. – PaulMcKenzie Aug 07 '22 at 02:23
  • @PaulMcKenzie I appreciate the offer to help with fixing the bug, but this post is just about comparing compiler versions. Unless you happen to be one of the <50 people who understand MSVC's implementation of coroutines, I'd rather not post the code. – Mark Wallace Aug 07 '22 at 02:49
  • I think it will compile fine, but to get it to run you will need to add a main 'int main()` method. Like this : https://www.godbolt.org/z/K5KqbP1ah. I also opened the output view (bottom left output button) and enabled execute in output drop down menu – Pepijn Kramer Aug 07 '22 at 03:52
  • @PepijnKramer there is no code in the OP. Just a link to godbolt.org. To prevent confusion in the future, I am removing the link. – Mark Wallace Aug 07 '22 at 03:57
  • @MarkWallace Ah ok – Pepijn Kramer Aug 07 '22 at 04:10

1 Answers1

1

You can look up version numbers here: Microsoft Visual C++ - Internal version numbering.

Godbolt uses _MSC_VER separated by a dot, e.g. 1914 is 19.14 on Godbolt.

krisz
  • 2,686
  • 2
  • 11
  • 18