积极答复者
在VS 2008中_tmain函数(不是main)将argv转换为string出错

问题
-
//头文件和其它代码省略了 编译器版本为vs 2008 9.0.21022.8 RTM
//为什么第一个就是可以编译通过的,但是第二个因为main函数和它的参数类型不对就编译出错。怎么解决
//报错信息见后面int main(int argc, char* argv[])
{
string str(argv[1]);
//some process code herereturn 0;
}int _tmain(int argc, _TCHAR* argv[])
{
string str(argv[1]);
//some process code herereturn 0;
}//报错信息
:>stl_sample.cpp
1>e:\vc_project\stl_sample\stl_sample\stl_sample.cpp(18) : error C2664: “std::basic_string<_Elem,_Traits,_Ax>::basic_string(std::basic_string<_Elem,_Traits,_Ax>::_Has_debug_it)”: 不能将参数 1 从“_TCHAR *”转换为“std::basic_string<_Elem,_Traits,_Ax>::_Has_debug_it”
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> struct“std::basic_string<_Elem,_Traits,_Ax>::_Has_debug_it”的构造函数声明为“explicit”
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]