473,396 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

using std::max

Hello

I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?

Angus

Jan 23 '07 #1
11 14290
"Angus" <no****@gmail.comwrote:
I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?
It is not "fairly new" is was there when the standard was ratified
AFAIK. Try using a different compiler.
Jan 23 '07 #2
Angus wrote:
Hello

I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?
No, but VC6 isn't very compliant. Time to upgrade.

--
Ian Collins.
Jan 23 '07 #3
On Jan 23, 3:18 pm, "Daniel T." <danie...@earthlink.netwrote:
"Angus" <nos...@gmail.comwrote:
I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:
using std::max; I get these compile errors in MS Visual C++ v6
error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration
I have #include'd <algorithm- but cannot see the function declared in
there.
Is max a fairly new standard library feature? How do I get this to work?It is not "fairly new" is was there when the standard was ratified
AFAIK. Try using a different compiler.
It's true, as others have pointed out, the VC6 was not especially
standards compliant.
(It was after all released before the C++ standard was finalized.)

However, in this particular case, you might want to check if the
problem is a conflict
with another header file. For example, speaking purely hypothetically
(hypotheticals
are always on topic right?), windows.h defines a macro named max. You
can turn this
off by defining the symbol NOMINMAX before you include windows.h.

Jan 23 '07 #4
Angus wrote:
Hello

I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?


VC6 is old, it may not be supported.

Jan 23 '07 #5
using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.
I've had troubles where I used std::max, only to figure out I really
needed something like std::max<int>. In particular, the error messages
were cryptic.

Without seeing your code, I don't know whether that might apply or not.

Michael

Jan 23 '07 #6
Angus wrote:
Hello

I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?

Angus
Since I don't think anyone else has mentioned it, you should know that
Microsoft now offers free versions of their compilers. Look for Visual
C++ Express Edition. It's much better than VC++ 6.
Jan 23 '07 #7
Angus wrote:
Hello

I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature?
Depends on what you mean by "fairly new". It has been part of standard C++
since the first version of the standard came out in 1998. However, the C++
standard itself is still newer than the compiler you are using.
How do I get this to work?
Well, if everything else fails, you could still define your own max()
template.

Jan 24 '07 #8


On 1ÔÂ24ÈÕ, ÉÏÎç6ʱ26·Ö, "Angus" <nos...@gmail.com>wrote:
Hello

I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?

Angus
ms visual c++ v6 doesn't support std enough;try dev c++,
"free C++ IDE for Windows and Linux for MinGW compiler";

Jan 24 '07 #9
Angus <no****@gmail.comwrote:
I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?
IIRC there is a list of workarounds for VC6 on the book's official
website (http://www.acceleratedcpp.com/ but it seems to be down at the
moment). However, as others suggested, I would recommend upgrading your
compiler to something more standards-compliant.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jan 24 '07 #10
Marcus Kwok <ri******@gehennom.invalidwrote:
Angus <no****@gmail.comwrote:
>I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?

IIRC there is a list of workarounds for VC6 on the book's official
website (http://www.acceleratedcpp.com/ but it seems to be down at the
moment).
After further investigation it appears that the domain name may have
expired. Here is a link to Google's cached version (mind the long line):

http://72.14.203.104/search?hl=en&lr...ml&btnG=Search

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jan 24 '07 #11

"Marcus Kwok" <ri******@gehennom.invalidwrote in message
news:ep*********@news-int2.gatech.edu...
Marcus Kwok <ri******@gehennom.invalidwrote:
Angus <no****@gmail.comwrote:
I am following the exercises in Accelerated C++ Practical Programming
by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: 'max' : is not a member of 'std'
error C2873: 'max' : symbol cannot be used in a using-declaration

I have #include'd <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to
work?

IIRC there is a list of workarounds for VC6 on the book's official
website (http://www.acceleratedcpp.com/ but it seems to be down at the
moment).

After further investigation it appears that the domain name may have
expired. Here is a link to Google's cached version (mind the long line):

http://72.14.203.104/search?hl=en&lr....mozilla%3Aen-
US%3Aofficial&hs=j93&q=cache%3Ahttp%3A%2F%2Fwww.ac celeratedcpp.com%2Fdetails
%2Fmsbugs.html&btnG=Search

The service pack 6 fixed most of it. Plus using some of the workarounds on
the web site you mentioned. Thanks for that. Very helpful.


Jan 25 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Bangalore | last post by:
Hi all, I have a problem in accessing elements using overloaded operator . Consider, const int SIZE=10; int FALSE=0; class Array { private: int x; public:
5
by: chaching | last post by:
Please help. The code below will compile and run using the Dev C compiler, but not the Visual C++ 2005 express edition. I need it to run in the express editions. any suggestions? #include...
2
by: Hendrik Schober | last post by:
Hi, consider this: #include <algorithm> enum X { foo, bar }; int main() {
10
by: JDT | last post by:
Hi, Can someone provide me an example that uses std::max_element() (probablly the predicate version) to return the max "absolute" integer in a vector? Your help is much appreciated. Tony ...
5
by: aaragon | last post by:
Hi everyone, I wrote a very simple function to try to understand the casting of variables in C++. The function is function foo() { std::vector<inttest(100); randomize(test); unsigned long...
8
by: Phil Endecott | last post by:
Dear Experts, I'm surprised to find that std::max doesn't work (i.e. won't compile) if the arguments are not of exactly the same type, e.g. one is a short and the other is a long: #include...
1
by: samoukos | last post by:
Hello i had to do this project but at school they tell me that it will be faster using stdio insteed of fstream... Is that right??? if it is faster can anyone suggest how this code will be using...
17
by: Adem24 | last post by:
What is the best way to get the minimum value and the maximum value an integral POD can hold without using any external definitions like INT_MIN, INT_MAX etc.? The type (short, int, long, etc.)...
0
by: Omendra | last post by:
Hi,I am creating my SP as dynamic, On that i am defining varchar(max) to need to get more than 8000 characters. But my SP is taken only 8000 characters when i am doing Print to my SP. Please...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.