About Monkey 2 › Forums › Monkey 2 Programming Help › Compile using MSCV
This topic contains 11 replies, has 4 voices, and was last updated by
nerobot 1 year, 8 months ago.
-
AuthorPosts
-
August 2, 2017 at 12:33 pm #9677
(Read Update at the bottom)
How do I get Monkey2 to use MSCV properly?
I know I need to set MX2_USE_MSVC to 1 in ‘env_windows.txt’
But what am I supposed to install?
I’ve installed Visual Studio Community 2017 and a bunch of build tools, but it still errors out every time I try to compile.C++1234567891011121314***** Building app 'C:/monkey2-develop/src/launcher/launcher.monkey2' *****Parsing...Semanting...Translating...Compiling..._r.cppC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directoryBuild error: System command 'cl -c -EHs -W0 -MT -Ox -DNDEBUG -I"C:/monkey2-develop/modules/" -I"C:/monkey2-develop/modules/monkey/native" -I"C:/monkey2-develop/src/launcher/" -Fo"C:/monkey2-develop/src/launcher/launcher.buildv1.1.06/windows_release_msvc/build/_1include_2_0r.cpp.obj" "C:/monkey2-develop/src/launcher/launcher.buildv1.1.06/windows_release_msvc/include/_r.cpp"' failed.cl -c -EHs -W0 -MT -Ox -DNDEBUG -I"C:/monkey2-develop/modules/" -I"C:/monkey2-develop/modules/monkey/native" -I"C:/monkey2-develop/src/launcher/" -Fo"C:/monkey2-develop/src/launcher/launcher.buildv1.1.06/windows_release_msvc/build/_1include_2_0r.cpp.obj" "C:/monkey2-develop/src/launcher/launcher.buildv1.1.06/windows_release_msvc/include/_r.cpp"Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x86Copyright (C) Microsoft Corporation. All rights reserved.It says ‘corecrt.h’ isn’t found, which is true, it’s not located there.
It’s in ‘C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt\’
I’ve added that path to ‘INCLUDE’ but it still errors outC++1234567891011121314***** Building app 'C:/monkey2-develop/src/launcher/launcher.monkey2' *****Parsing...Semanting...Translating...Compiling..._r.cppBuild error: System command 'g++ -c -std=c++11 -m32 -D_WIN32_WINNT=0x0603 -O3 -DNDEBUG -I"C:/monkey2-develop/modules/" -I"C:/monkey2-develop/modules/monkey/native" -I"C:/monkey2-develop/src/launcher/" -MM "C:/monkey2-develop/modules/std/std.buildv1.1.06/windows_release_msvc/include/_r.cpp" >"C:/monkey2-develop/src/launcher/launcher.buildv1.1.06/windows_release_msvc/build/_1_1_1_1_1modules_2std_2std.buildv1.1.06_2windows_0release_0msvc_2include_2_0r.cpp.deps"' failed.g++ -c -std=c++11 -m32 -D_WIN32_WINNT=0x0603 -O3 -DNDEBUG -I"C:/monkey2-develop/modules/" -I"C:/monkey2-develop/modules/monkey/native" -I"C:/monkey2-develop/src/launcher/" -MM "C:/monkey2-develop/modules/std/std.buildv1.1.06/windows_release_msvc/include/_r.cpp" >"C:/monkey2-develop/src/launcher/launcher.buildv1.1.06/windows_release_msvc/build/_1_1_1_1_1modules_2std_2std.buildv1.1.06_2windows_0release_0msvc_2include_2_0r.cpp.deps"g++: error: C:/monkey2-develop/modules/std/std.buildv1.1.06/windows_release_msvc/include/_r.cpp: No such file or directoryg++: fatal error: no input filescompilation terminated.UPDATE: Alright so instead of adding that path, I went over and changed all old version numbers in ‘env_windows.txt’ to my 15063 version.
And it does seem to compile some things.. but Ted2Go for example does not compile.C++12345678910111213141516171819202122Creating library C:/monkey2-develop/src/ted2go/ted2.buildv1.1.06/windows_release_msvc/ted2.lib and object C:/monkey2-develop/src/ted2go/ted2.buildv1.1.06/windows_release_msvc/ted2.expsdl2.lib(_1_1_1SDL_2src_2core_2windows_2SDL_0windows.c.obj) : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function _WIN_LookupAudioDeviceNamesdl2.lib(_1_1_1SDL_2src_2core_2windows_2SDL_0windows.c.obj) : error LNK2019: unresolved external symbol __imp__RegOpenKeyExW@20 referenced in function _WIN_LookupAudioDeviceNamesdl2.lib(_1_1_1SDL_2src_2core_2windows_2SDL_0windows.c.obj) : error LNK2019: unresolved external symbol __imp__RegQueryValueExW@24 referenced in function _WIN_LookupAudioDeviceNameC:/monkey2-develop/src/ted2go/ted2.buildv1.1.06/windows_release_msvc/ted2.exe : fatal error LNK1120: 3 unresolved externalsBuild error: System command 'link -subsystem:windows -entry:mainCRTStartup -out:"C:/monkey2-develop/src/ted2go/ted2.buildv1.1.06/windows_release_msvc/ted2.exe" @tmp/lnkFiles1.txt' failed.link -subsystem:windows -entry:mainCRTStartup -out:"C:/monkey2-develop/src/ted2go/ted2.buildv1.1.06/windows_release_msvc/ted2.exe" @tmp/lnkFiles1.txt***** Fatal mx2cc error *****Internal mx2cc build errorFile not found - assets0 File(s) copiedFile not found - *.dll0 File(s) copiedFile not found - *.exe0 File(s) copiedMx2cc version 1.1.06August 2, 2017 at 8:54 pm #9684Regarding your linking issue, I closed this issue but perhaps it is still pertinent.
August 2, 2017 at 10:40 pm #9686Weirdly, I have never had the link error. MSVC was intended to be used with msvc 2015 express not community 2017, so I thought it might be that, but I just tried changing the msvc paths to Hezkore’s (already had community 2017 installed), rebuilt all modules, and still no problem, can build anything including ted2go just fine.
Will add the libadvapi import to SDL2 though for the next release.
August 2, 2017 at 11:44 pm #9689Yup, MSCV works now.
I’m not sure compile times improved though…
Is there anything else I can do to improve compile times?August 2, 2017 at 11:50 pm #9690Is there anything else I can do to improve compile times?
Nope.
August 2, 2017 at 11:52 pm #9691Well haha, fair enough!
August 3, 2017 at 12:12 am #9693Faster hardware might help?
I am on latest KabyLake I3 with SSD and DDR4 ram at +2GHZ and finding MSVC compile times very good although I suppose that is subjective.
August 3, 2017 at 12:15 am #9694I’m on a 8 core 4.5GHz processor with 16Gb RAM, using 4 SSDs in Raid 0.
It takes 15-20 seconds to compile my largest project. :/
BlitzMax compiles roughly the same thing at a few seconds.August 3, 2017 at 12:43 am #9695After the first couple of builds, compile times are OK here but then I’m used to c++. Linking is the slowest step and MSVC speeds that up a lot for me.
With ted2go (after a couple of builds) and after changing a single file, parsing, semanting, translating, compiling are 3-ish seconds, linking is 15-ish. Changing more files increases compile times. Making different changes also affects compile times.
With MSVC, link time goes down to just a few seconds, so build time goes from 18-ish seconds to 5 ish seconds.
Also possibly worth noting, if you’re using the ‘mega file’ approach of sticking all your code in one file, then yes, compile times will hurt!
August 3, 2017 at 3:18 am #9705Is it possible to use any kind of “portable msvc” (does it exist or not) to avoid installing vstudio?
August 3, 2017 at 3:21 am #9706There is some info here on that topic, interested in how you get on.
August 3, 2017 at 7:07 am #9709Thanks, Simon.
-
AuthorPosts
You must be logged in to reply to this topic.