Author Topic: VS2017 and Global Variables  (Read 1224 times)

Offline jamesson

  • Multiple posting newcomer
  • *
  • Posts: 10
VS2017 and Global Variables
« on: March 10, 2019, 11:33:26 pm »
I was trying to follow the instructions at https://github.com/arnholm/cpde_utils/blob/master/doc/toolchain/CodeBlocks_MSVC_setup.pdf using VS2017. It gives instructions for VS/VS express 2013. However, after I got about halfway, I realized that there were 2 folder trees that satisfied (some of) the requirements, one at

C:\Program Files (x86)\Microsoft Visual Studio 14.0

and the other at


C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise

Should I use one of these consistently? If so, which?

Offline cacb

  • Regular
  • ***
  • Posts: 398
Re: VS2017 and Global Variables
« Reply #1 on: March 11, 2019, 09:34:29 am »
Hi jamesson,

That's my page at github. I don't have a ready reply for you regarding VS2017, since I still use VS2013 with Code::Blocks, but please post anything you conclude here, and I will update the document when you have a successful configuration. I might even upgrade then :-)

Traditionally, it has been a combination of Visual Studio folders and "Windows Kits" (these terms tend to vary) to get everuthing working, that's what that document reflects.

Please keep us posted.

Offline sodev

  • Regular
  • ***
  • Posts: 329
Re: VS2017 and Global Variables
« Reply #2 on: March 11, 2019, 10:32:57 am »
The first path could be a Visual Studio 2015 installation, the second path is a Visual Studio 2017 Enterprise installation. Choose the path of the compiler you want to use :).

Getting VS2017 to run requires a lot of changes to the pdf, the paths completely changed and some CodeBlocks requirements are not met anymore, someone else posted on this forum how to setup, im too lazy to dig up the thread ;D. To use VS2015 i think the pdf misses the paths to the CRT, otherwise it should still apply.

Offline cacb

  • Regular
  • ***
  • Posts: 398
Re: VS2017 and Global Variables
« Reply #3 on: March 11, 2019, 11:04:55 am »
The first path could be a Visual Studio 2015 installation, the second path is a Visual Studio 2017 Enterprise installation. Choose the path of the compiler you want to use :).

Getting VS2017 to run requires a lot of changes to the pdf, the paths completely changed and some CodeBlocks requirements are not met anymore, someone else posted on this forum how to setup, im too lazy to dig up the thread ;D. To use VS2015 i think the pdf misses the paths to the CRT, otherwise it should still apply.

Agreed, I would be interested in the VS2015 configuration, as I have access to it. With CRT I presume you mean C Run-Time libraries.

Offline sodev

  • Regular
  • ***
  • Posts: 329
Re: VS2017 and Global Variables
« Reply #4 on: March 11, 2019, 02:24:02 pm »
It's their universal crt that is new since that version, it's only a part of the runtime libraries.

My current VS2015 setup is described here http://forums.codeblocks.org/index.php/topic,22009.msg149847.html#msg149847, because i use the Windows XP toolkit im using another SDK and need some paths less.

Offline jamesson

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: VS2017 and Global Variables
« Reply #5 on: March 12, 2019, 01:41:59 am »
Hi jamesson,

That's my page at github. I don't have a ready reply for you regarding VS2017, since I still use VS2013 with Code::Blocks, but please post anything you conclude here, and I will update the document when you have a successful configuration. I might even upgrade then :-)

Traditionally, it has been a combination of Visual Studio folders and "Windows Kits" (these terms tend to vary) to get everuthing working, that's what that document reflects.

Please keep us posted.


Cacb, would you be willing to help me update the PDF?

If so, please post as many as possible specific filenames you expect to find in all the variable directories

Thanks

Joe

Offline New Pagodi

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: VS2017 and Global Variables
« Reply #6 on: March 12, 2019, 03:55:31 am »
Here are the directions I use for using Visual C++ 2017 with Code::Blocks.

Offline jamesson

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: VS2017 and Global Variables
« Reply #7 on: March 12, 2019, 09:19:19 pm »
New Pagodi:

Sorry, maybe I am not reading it correctly. Which directions are you referring to? The thread seems to terminate in a discussion of the bugs in your configuration.

Offline New Pagodi

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: VS2017 and Global Variables
« Reply #8 on: March 12, 2019, 09:45:34 pm »
Those directions work now.  Except for the popup when codeblocks starts which has to be ignored for now.

Offline jamesson

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: VS2017 and Global Variables
« Reply #9 on: March 12, 2019, 10:04:22 pm »
You mean, the bug involving spaces in directory names has been dealt with?

Thanks again

Joe
« Last Edit: March 12, 2019, 10:06:08 pm by jamesson »

Offline jamesson

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: VS2017 and Global Variables
« Reply #10 on: March 12, 2019, 10:05:46 pm »
Also, how do you mean, whatever path Visual C++ is installed to? Which file specifically am I looking for? devenv.exe or something else? How do I know my vcversion? What file am I looking for in there?
« Last Edit: March 12, 2019, 10:12:12 pm by jamesson »

Offline New Pagodi

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: VS2017 and Global Variables
« Reply #11 on: March 13, 2019, 05:14:39 am »
Step by step.  To find the vc version, look in windows explorer.  If you installed in the to the default location, look at the folder C:\Program Files\Microsoft Visual Studio 2017\VC\Tools\MSVC.  You should see one or more subfolders named 14.xx.xxxx.  Use the name of the last folder for the vc version.



To find the SDK version, look at the folder where you installed the windows 10 sdk.  The default location is C:\Program Files (x86)\Windows Kits\10.  Look at either the include or lib subfolders. You should see one or more folders named 10.0.xxxxx.0. Use the name of that last folder for the sdk version.



In codeblocks, go to Settings->Compiler... In the dialog that pops up, select Microsoft Visual C++ 2010 and hit the "Copy" button.



Enter a name for the new compiler.



Select the custom variables tab, and create 4 variables WINSDKROOT, WINSDKVERSION, VCROOT, and VCVERSION.



For WINSDKVERSION and VCVERSION use the numbers found above.  If you use the default installation location WINSDKROOT should be C:\Program Files (x86)\Windows Kits\10 and VCROOT should be C:\Program Files\Microsoft Visual Studio 2017\VC\Tools\MSVC.  When you enter these variables, a popup will ask if you want to surround these in quotes.  Hit the "Leave unquoted" button.



Move to the Toolchain executables tab.  The only thing that needs to be changed is to enter $(VCROOT)\$(VCVERSION)\bin\Hostx64\x64 for the compiler's installation directory.  All other items can be left with their default values.




Next hit Additional path's sub-tab.  Enter $(WINSDKROOT)\bin\$(WinSDKVersion)\x64 and $(WINSDKROOT)\Debuggers\x64




Move to the Search directories tab and the Compiler sub-tab.  Enter
$(VCRoot)\$(VCVersion)\include
$(WinSDKRoot)\include\$(WinSDKVersion)\shared
$(WinSDKRoot)\include\$(WinSDKVersion)\ucrt
$(WinSDKRoot)\include\$(WinSDKVersion)\um



You can also add
$(WinSDKRoot)\include\$(WinSDKVersion)\winrt
$(WinSDKRoot)\include\$(WinSDKVersion)\cppwinrt

but I have not needed those yet.

On the linker sub-tab add
$(VCRoot)\$(VCVersion)\lib\x64
$(WinSDKRoot)\lib\$(WinSDKVersion)\ucrt\x64
$(WinSDKRoot)\lib\$(WinSDKVersion)\um\x64



On the resource compiler sub-tab add
$(WinSDKRoot)\include\$(WinSDKVersion)\shared
$(WinSDKRoot)\include\$(WinSDKVersion)\um



The compiler is now ready for use with codeblocks.  The only slight problem is that when codeblocks starts, you'll get a warning like the following:



Despite this warning, it does work.