c:\program files\microsoft visual studio\vc98\include\functional(86) : error C2784: 'bool __cdecl std::operator <(const class std::multimap< _K,_Ty,_Pr,_A > &,const class std::multimap< _K,_Ty,_Pr,_A > &)' : could not deduce template argument for 'const
class std::multimap< _K,_Ty,_Pr,_A > &' from 'const class std::basic_string< char,struct std::char_traits< char >,class std::allocator< char > >'
But they are actually errors in the "< functional >" and "< xtree >" files included in "map."
Can anyone help me out, please? Thanks in advance!
"#include map" creates A LOT of errors! =(
Okay, I finally got the idea of using std::map for the problem I was having yesterday, thanks to a few members (thanks) =). Well, sort of. When I "#include" the file "map" the compiler generates A LOT of errors in "map." Here are some of them:
The errors might look like they're in <map>, but that's just because that's where the template definitions are. The real error is most likely in your code. If you look a few lines further in the compiler errors, it may even tell you where. In any case, post your code.
Okay, you are right. Sorry, I didn't think about that. =) Anyhow, I tried creating a blank project and including the file, and it worked fine. Here's my code:
Even that little bit of code causes the problem. But, when I comment the last line out, it works fine. What is wrong with that?
// These lines are in the header file typedef std::map<std::string, cmdfunc_t> Commands; Commands m_pCmds; // This is in the source file m_pCmds.insert(std::make_pair(szCmdName, pCmdFunc));
Even that little bit of code causes the problem. But, when I comment the last line out, it works fine. What is wrong with that?
Depending on your compiler, you can get errors like that if you forget to include the string header.
Hey, I'm sorry. I forgot all about specifying my compiler. I am using Visual C++ 6.0. If that helps any. =)
Ho 'bout:
Any better?
#include <map>// These lines are in the header filetypedef std::map<std::string, cmdfunc_t> Commands;typedef std::pair<std::string, cmdfunc_t> CommandsPair;Commands m_pCmds;// This is in the source filem_pCmds.insert(CommandsPair(szCmdName, pCmdFunc));
Any better?
Okay, everything is working out okay. But now, I have another problem. When I do:
m_pCmds.insert(CommandsPair(szCmdName, pCmdFunc));
I get an access violation. "The instruction at '0x10240eef' referenced memory at '0xcdcdcdcd'. The memory could not be 'read'." And when I debug, it goes back to "MEMCMP.ASM" (MSVCRTD.DLL). But when I comment out the "insert" line, it goes right through it. What could be causing this?
m_pCmds.insert(CommandsPair(szCmdName, pCmdFunc));
I get an access violation. "The instruction at '0x10240eef' referenced memory at '0xcdcdcdcd'. The memory could not be 'read'." And when I debug, it goes back to "MEMCMP.ASM" (MSVCRTD.DLL). But when I comment out the "insert" line, it goes right through it. What could be causing this?
Can you show the whole code, or is it too big?
If not how about the declaration of pCmdFunc and cmdfunc_t?
I am a little concerned that pCmdFunc is a cmdfunc_t*
so you would need either:
OR
If not how about the declaration of pCmdFunc and cmdfunc_t?
I am a little concerned that pCmdFunc is a cmdfunc_t*
so you would need either:
#include <map>// These lines are in the header filetypedef std::map<std::string, cmdfunc_t*> Commands;typedef std::pair<std::string, cmdfunc_t*> CommandsPair;Commands m_pCmds;// This is in the source filem_pCmds.insert(CommandsPair(szCmdName, pCmdFunc));
OR
#include <map>// These lines are in the header filetypedef std::map<std::string, cmdfunc_t> Commands;typedef std::pair<std::string, cmdfunc_t> CommandsPair;Commands m_pCmds;// This is in the source filem_pCmds.insert(CommandsPair(szCmdName, *pCmdFunc));
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement