Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

map<string,string> compile errors

Console app in VC7 on W2K

Hello,

I'm trying to compile the following code. In the simple program below no
problem. In my real program ( a Windows Service) the insert method causes
compile errors. The compiler and linker flags seem to be the same in both
programs. Obviously there is some environment difference between my two
programs, but I can't see it. Any help would be appreciated.

Thanks,
kevin aubuchon

Compiler settings:
/O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /EHsc /ML /GS /Fx
/FAs /Fa"Release/" /Fo"Release/" /Fd"Release/vc70.pdb" /W3 /nologo /c /TP

Linker settings:
/OUT:"Release/service_one.exe" /INCREMENTAL:NO /NOLOGO /SUBSYSTEM:CONSOLE
/OPT:REF /OPT:ICF /MACHINE:X86 kernel32.lib user32.lib gdi32.lib
winspoo
l.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
uuid.lib odbc32.lib odbccp32.lib

====Compile Time Errors=====
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\functional(139): error C2676: binary '<' : 'const
std::string' does not define this operator or a conversion to a type
acceptable to the predefined operator

C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\functional(139): error C2784: 'bool std::operator <(const
std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce
template argument for 'const std::_Tree<_Traits> &' from 'const std::string'


#define _WIN32_WINNT 0x0400

#include "stdafx.h"

#include

#include

#include

#include



typedef std::map<:STRING> STRINGMAP_TYPE;

typedef STRINGMAP_TYPE::value_type ST_value_type;

int _tmain(int argc, _TCHAR* argv[])

{

return 0;

STRINGMAP_TYPE strings;

ST_value_type* pvt;

std::string key = "hello";

std::string ob
ject = "hello";

pvt = new ST_value_type(key,object);

strings.insert (*pvt);


}
0 Kudos
Message 1 of 2
(3,344 Views)
Hello Kevin,

Try this example.
I have found it on MSDN
I have rewritten from INT2STRING to STRING2STRING

It seems you have to ignore the warnings

Greetings
Juergen
0 Kudos
Message 2 of 2
(3,344 Views)