dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: VS 2015 and standard headers

  1. #1
    Join Date
    Feb 2009
    Posts
    48

    Question VS 2015 and standard headers

    Hello, I'm first time trying to compile old C sources with VC14 and it seems some standard headers are missing

    math.h

    It appeared as present yet as in VC12. What is replacement of this? Thanks

  2. #2
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,716

    Re: VS 2015 and standard headers

    Try:

    Code:
    #include <cmath>

  3. #3
    Join Date
    Feb 2009
    Posts
    48

    Re: VS 2015 and standard headers

    Thanks for hint Philip Nicoletti but if the sources are from 3rd party and I don't want to edit them is there a way to redirect?

  4. #4
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,816

    Re: VS 2015 and standard headers

    math.h is definitely available for VS 2015. It is c standard library header.
    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++17 Compiler: Microsoft VS2019 (16.2.5)

  5. #5
    Join Date
    Feb 2009
    Posts
    48

    Re: VS 2015 and standard headers

    Really? That gives sense but I don't have the header file in my C:\Program Files (x86)\Visual Studio 2015\VC\include\

    What's wrong? Setup finshed more or less successfully and I of course included C++

  6. #6
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,816

    Re: VS 2015 and standard headers

    Yikes! math.h is not in ...\visual Studio 14\vc\include. With my VS2015 install it is picking up math.h from ...\windows kits\10\include\10.0.10240.0\ucrt ?????
    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++17 Compiler: Microsoft VS2019 (16.2.5)

  7. #7
    Join Date
    Feb 2009
    Posts
    48

    Re: VS 2015 and standard headers

    IMHO the math.h shouldnot be picked from anywhere else than vc\include.
    The setup seems somehow fishy as it reported some 3rd party component errors on completion.
    Add/Remove programs control panel offers only Modify which gives error message

    Error on attempt to uninstall Microsoft Visual Studio Enterprise 2015 item. Probably it was already uninstalled.
    Do you want to remove Microsoft Visual Studio Enterprise 2015 item from Programs and functions list?
    Therefore I don't have an idea how to fix the installation.

  8. #8
    Join Date
    Jun 2015
    Posts
    208

    Re: VS 2015 and standard headers

    Quote Originally Posted by Anakunda View Post
    Therefore I don't have an idea how to fix the installation.
    Here's info about breaking changes in VS 2015.

    https://msdn.microsoft.com/en-us/library/bb531344.aspx

    Search for math.h on that page.

  9. #9
    Join Date
    Feb 2009
    Posts
    48

    Re: VS 2015 and standard headers

    Thanks tiliavirga for useful link. The article describes that all content of math.h was moved to cmath but is not clear if math.h was completely removed or stayed as dummy file with include redirect. Can you confirm math.h is completely missing?

    What solution would you suggest then if I don't want to modify existing sources?

    #ifdef _STD_USING
    #undef _STD_USING
    #include <math.h> <======= still referencing C header file which is not present in whole VS directory
    #define _STD_USING
    #else /* _STD_USING */
    #include <math.h> <======= math.h
    #endif /* _STD_USING */
    Last edited by Anakunda; December 15th, 2015 at 05:17 AM.

  10. #10
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,816

    Re: VS 2015 and standard headers

    Have you searched your system to see if you can find it somewhere?
    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++17 Compiler: Microsoft VS2019 (16.2.5)

  11. #11
    Join Date
    Feb 2009
    Posts
    48

    Re: VS 2015 and standard headers

    Compiler finds it in C:\Users\Anakunda\Documents\C\3rd_party\STLport\stlport\math.h but this seems not more compatible (sources are from 2008)

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)