DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Where is Min Max in VS Pro 2005?

  1. #1
    Join Date
    Sep 2007
    Location
    London
    Posts
    22

    Where is Min Max in VS Pro 2005?

    I am converting code to run as a DLL in C++ in VisualStudio Pro 2005 under Windows XP.

    The code starts with:

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <math.h>
    #include <io.h>

    It has a line using the Max math function:

    start = Math::Max(0, start - (cnt * 0.03));

    Yet this line creates two errors:
    C2027 use of undefined type ‘Math’
    C3861 ‘Max’: identifier not found

    Please can you help me with my math settings etc.

    Thank you

  2. #2
    Join Date
    May 2006
    Posts
    176
    In my opinion a notation like Math::Max means that you are trying to use a function from another C++ -- “managed C++” or “CLR”. Please give us details about the type of your application.

    If it is not a managed C++, then you can use the std::min and std::max function from STL, defined in <algorithm> header file. But it may not work if you also use some Windows header files which give another definition. For solution, see http://support.microsoft.com/kb/143208.

    Alternatively you can use __min and __max defined in <stdio.h>.

    I hope this helps.

  3. #3
    Join Date
    Sep 2007
    Location
    London
    Posts
    22

    Thank you - problem solved

    I have just experimented with both __min and std::min and both formats have cleared my compliation errors.


    Many thanks for your quick, helpful reply.

Similar Threads

  1. store min and max value in variable...
    By luca90 in forum VB Classic
    Replies: 0
    Last Post: 09-07-2007, 04:03 AM
  2. min max
    By ami in forum C++
    Replies: 10
    Last Post: 01-03-2007, 10:55 AM
  3. find MAX and MIN of a field in a long recordset
    By THIEFs in forum VB Classic
    Replies: 1
    Last Post: 03-15-2003, 09:41 PM
  4. SQL Min Max HELP!
    By Ian Stone in forum VB Classic
    Replies: 11
    Last Post: 07-20-2001, 03:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center