|
-
April 6th, 2004, 08:56 AM
#1
Compiler error for s.clear()
Consider the following code:
Code:
string dup(char c, int n) {
string s;
s.clear();
s.insert(s.begin(), n, c);
return s; }
My compiler is: Microsoft Visual C++ 6.0
The compiler error I receive is:
h:\c++\proj12ateame\basicutils.h(32) : error C2039: 'clear' : is not a member of 'basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
This code works FINE on Microsoft Visual Studio .NET 2003, yet it doesn't on Visual C++ 6.0? If someone could explain to me what's going on, I would be grateful.
The header files I have included with this code are <string> and <math.h>
Thanks again guys. You're very helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|