CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2014
    Posts
    37

    [RESOLVED] Visual Studio update breaks my batch file compiling

    FYI:
    I compile most all my c/c++ code using batch files.
    My ide sets environment vars before calling the batch file.
    I set INCLUDE to point to my personal include folder and with prior versions this worked fine.
    I recently updated my Visual Studio 2017 community and now it cannot find my include folder.
    I have another environment var MYINC that also points to my include file.
    By using cl.exe /I%MYINC% ...... in the batch files it now works as expected.
    It is probably something I should have done in the first place but .....

    James

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Visual Studio update breaks my batch file compiling

    Quote Originally Posted by jcfuller View Post
    FYI:
    I compile most all my c/c++ code using batch files.
    My ide sets environment vars before calling the batch file.
    I set INCLUDE to point to my personal include folder and with prior versions this worked fine.
    I recently updated my Visual Studio 2017 community and now it cannot find my include folder.
    I have another environment var MYINC that also points to my include file.
    By using cl.exe /I%MYINC% ...... in the batch files it now works as expected.
    It is probably something I should have done in the first place but .....

    James
    Are you running the batch file from a Visual Studio command prompt?

  3. #3
    Join Date
    Nov 2014
    Posts
    37

    Re: Visual Studio update breaks my batch file compiling

    Quote Originally Posted by Arjay View Post
    Are you running the batch file from a Visual Studio command prompt?
    No I am not. I shell to cmd.exe from my editor. I have been running this way with VS 2013,2015,and 2017 without problems until the last VS 2017 update.

    James

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,825

    Re: Visual Studio update breaks my batch file compiling

    Have you reported it as an issue? See https://developercommunity.visualstu...index.html?all
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  5. #5
    Join Date
    Nov 2014
    Posts
    37

    Re: Visual Studio update breaks my batch file compiling

    Quote Originally Posted by 2kaud View Post
    Have you reported it as an issue? See https://developercommunity.visualstu...index.html?all
    No I have not because here:
    https://docs.microsoft.com/en-us/cpp...ment-variables
    it says
    INCLUDE, which must point to the \include subdirectory of your Visual C++ installation
    So I figured I may have been using it in an undocumented way and for some unknown reason it was working??
    Everything is fine now by adding the /I%MYINC% in my batch files. This was more of an FYI post just in case others were having issues. I doubt very many coders use batch files with the latest Visual Studio c/c++ but I thought I'd pass along my findings anyway

    James

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: [RESOLVED] Visual Studio update breaks my batch file compiling

    Looks like Visual Studio has cleaned up what environment variables it sets during installation. I would guess that it sets less system/user variables during a vs install and relies on folks using the visual studio command prompt when they need a VS cmd env. Try typing c:\set from both command prompts (i.e. regular and Visual Studio) and compare the envirinment variables. The vs cmd prompt is simply a batch file that sets extra env variables. If you want the 'older' build experience simply add missing env variables to the system or user settings.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured