Author |
Message |
tansey Novice
Joined: Nov 03 2004 Posts: 53 Offline
|
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Tue Dec 21, 2004 1:07 pm Post subject: |
 |
|
|
|
Make sure you have the line "using namespace std;" at the top of every file that uses STL classes.
Also make sure you don't ever use STL classes because they're the worst thing to debug in ages. _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
 |
tansey Novice
Joined: Nov 03 2004 Posts: 53 Offline
|
Posted: Tue Dec 21, 2004 1:25 pm Post subject: |
 |
|
|
|
Yep, tried that...
When i did using namespace std but it said:
Quote: | c:\program files\continuum\mervbot\src\hostbot\hostbot.h(15) : error C2871: 'std' : does not exist or is not a namespace |
|
|
Back to top |
|
 |
Underlord Novice
Gender: Joined: Feb 17 2004 Posts: 55 Offline
|
|
Back to top |
|
 |
tansey Novice
Joined: Nov 03 2004 Posts: 53 Offline
|
Posted: Tue Dec 21, 2004 3:41 pm Post subject: |
 |
|
|
|
Thanks so far! But now it's giving me more errors:
Quote: | c:\program files\continuum\mervbot\src\hostbot\hostbot.h(144) : warning C4786: 'std::pair<std::_Tree<int,int,std::set<int,std::less<int>,std::allocator<int> >::_Kfn,std::less<int>,std::allocator<int> >::const_iterator,std::_Tree<int,int,std::set<int
,std::less<int>,std::allocator<int> >::_Kfn,std::less<int>,std::allocator<int> >::const_iterator>' : identifier was truncated to '255' characters in the debug information
c:\program files\continuum\mervbot\src\hostbot\hostbot.h(144) : warning C4786: 'std::reverse_bidirectional_iterator<std::_Tree<Player *,std::pair<Player * const,int>,std::map<Player *,int,std::less<Player *>,std::allocator<int> >::_Kfn,std::less<Pla
yer *>,std::allocator<int> >::iterator,std::pair<Player * const,int>,std::pair<Player * const,int> &,std::pair<Player * const,int> *,int>' : identifier was truncated to '255' characters in the debug information
c:\program files\continuum\mervbot\src\hostbot\hostbot.h(144) : warning C4786: 'std::reverse_bidirectional_iterator<std::_Tree<Player *,std::pair<Player * const,int>,std::map<Player *,int,std::less<Player *>,std::allocator<int> >::_Kfn,std::less<Pla
yer *>,std::allocator<int> >::const_iterator,std::pair<Player * const,int>,std::pair<Player * const,int> const &,std::pair<Player * const,int> const *,int>' : identifier was truncated to '255' characters in the debug information
c:\program files\continuum\mervbot\src\hostbot\hostbot.h(144) : warning C4786: 'std::pair<std::_Tree<Player *,std::pair<Player * const,int>,std::map<Player *,int,std::less<Player *>,std::allocator<int> >::_Kfn,std::less<Player *>,std::allocator<int>
>::iterator,std::_Tree<Player *,std::pair<Player * const,int>,std::map<Player *,int,std::less<Player *>,std::allocator<int> >::_Kfn,std::less<Player *>,std::allocator<int> >::iterator>' : identifier was truncated to '255' characters in the debug in
formation
c:\program files\continuum\mervbot\src\hostbot\hostbot.h(144) : warning C4786: 'std::pair<std::_Tree<Player *,std::pair<Player * const,int>,std::map<Player *,int,std::less<Player *>,std::allocator<int> >::_Kfn,std::less<Player *>,std::allocator<int>
>::const_iterator,std::_Tree<Player *,std::pair<Player * const,int>,std::map<Player *,int,std::less<Player *>,std::allocator<int> >::_Kfn,std::less<Player *>,std::allocator<int> >::const_iterator>' : identifier was truncated to '255' characters in
the debug information |
Also, it's having trouble with the String class being recognized:
Quote: | c:\program files\continuum\mervbot\src\hostbot\spawn.h(242) : error C2664: 'void __thiscall botInfo::sendPublic(char *)' : cannot convert parameter 1 from 'class String' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called |
|
|
Back to top |
|
 |
tansey Novice
Joined: Nov 03 2004 Posts: 53 Offline
|
Posted: Tue Dec 21, 2004 5:43 pm Post subject: |
 |
|
|
|
Okay, I figured out the issues with the map, but my String issues are still there. For some reason, it's not acknowledging the operator overloaders or the copy constructors or anything like that.
Is it maybe because of my namespace std; declaration, since String is a class not in that namespace? |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Tue Dec 21, 2004 5:54 pm Post subject: |
 |
|
|
|
Knitting is a fun hobby I hear. _________________ 4,691 irradiated haggis! |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Tue Dec 21, 2004 6:01 pm Post subject: |
 |
|
|
|
Make sure "#define STRING_CAST_CHAR" is at the top of spawn.h. |
|
Back to top |
|
 |
tansey Novice
Joined: Nov 03 2004 Posts: 53 Offline
|
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Tue Dec 21, 2004 7:41 pm Post subject: |
 |
|
|
|
ouch Ekted, lol
do you not like the STL? _________________
 |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Tue Dec 21, 2004 8:08 pm Post subject: |
 |
|
|
|
Ekted is old skewl... He's too good for STL ... lol. _________________ Performance is often the art of cheating carefully. - James Gosling |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Tue Dec 21, 2004 8:18 pm Post subject: |
 |
|
|
|
maybe some day I will level up into a Mr Ekted |
|
Back to top |
|
 |
tansey Novice
Joined: Nov 03 2004 Posts: 53 Offline
|
Posted: Tue Dec 21, 2004 8:28 pm Post subject: |
 |
|
|
|
um....is there any other library you guys would reccommend to use that has both a map and a set class? I know stl has a lot of memory leaks, but it's all I know!  |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Tue Dec 21, 2004 11:02 pm Post subject: |
 |
|
|
|
I don't see it at the top of that file. And it should be in the spawn.h.
As far as STL goes, you'll learn a lot about the language if you do it yourself. That's what I did, and man, do I feel in control of my program.
And, of course, you can always re-use a template class once you've made one. |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
|
Back to top |
|
 |
tansey Novice
Joined: Nov 03 2004 Posts: 53 Offline
|
Posted: Wed Dec 22, 2004 5:17 am Post subject: |
 |
|
|
|
I've written all these classes on my own before too, for my CS classes...but I would tend to think that a guy who's only got 7 months c++ experience wouldn't make as efficient a map/set class as the stl writers (HP?) |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Wed Dec 22, 2004 10:51 am Post subject: |
 |
|
|
|
Oh, they might not be efficient, but you can always improve them in the future. The ease of debugging makes up for any slight efficiency loss. |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Wed Dec 22, 2004 11:33 am Post subject: |
 |
|
|
|
No matter how efficient the String class is, you can write the code above that runs 10-20x faster, and it's MUCH easier to debug. |
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Wed Dec 22, 2004 11:38 am Post subject: |
 |
|
|
|
You can't perform less than two allocations for that functions task.
I agree that having that code inline would be much easier to debug, though. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Wed Dec 22, 2004 12:49 pm Post subject: |
 |
|
|
|
You could only perform one allocation if the class was designed properly.
And my talking about efficiency was mainly targeted towards var-length arrays, trees, etc. |
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Wed Dec 22, 2004 6:01 pm Post subject: |
 |
|
|
|
STL doesn't have memory leaks, where did you hear that?
the String class is not STL's class... it's written by catid |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Wed Dec 22, 2004 6:45 pm Post subject: |
 |
|
|
|
I wrote a string class once. |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Wed Dec 22, 2004 11:42 pm Post subject: |
 |
|
|
|
OMFG I DID TOO OMG OMG OMG WHAT'S YOUR #?? |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Thu Dec 23, 2004 11:41 am Post subject: |
 |
|
|
|
I wrote a string class never. |
|
Back to top |
|
 |
|