声明地图的问题 [英] Problems declaring a map

查看:64
本文介绍了声明地图的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:


#include< map>

#include< string>

使用std :: string;

使用std :: map;


int sc_main(int ac,char * av [])

{

map< char,stringstart;

map< char,string> :: iterator si;

}


当我尝试编译它时:


main.cpp(55):错误C2653:''map< char,class

std :: basic_string< char,struct std :: char_traits< char>,class

std :: allocator< char,struct std :: less< char>,class s

我做错了什么?

I''ve the following code:

#include <map>
#include <string>

using std::string;
using std::map;

int sc_main(int ac, char *av[])
{
map<char,stringstart;
map<char,string>::iterator si;
}

When I try to compile it :

main.cpp(55) : error C2653: ''map<char,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char,struct std::less<char>,class s
What I''m doing wrong?

推荐答案

错误就是那个(之前没有完成)线程):


main.cpp(55):错误C2653:''map< char,class

std :: basic_string< char,struct std: :char_traits< char>,类

std :: allocator< char,struct std :: less< char>,class

std :: allocator& lt; class std :: basic_string< char,struct

std :: char_traits< char>,class std :: allocator< char'':不是

类或者命名空间名称

The error is that one (not complete in previous thread) :

main.cpp(55) : error C2653: ''map<char,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char,struct std::less<char>,class
std::allocator<class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char '' : is not a
class or namespace name


Enric写道:
Enric wrote:

我有以下代码:


#include< map>

#include< string>


使用std :: string;

使用std :: map;


int sc_main(int ac,char * av [])

{

map< char,stringstart;

map< char,string> :: iterator si;

}


我尝试编译它:


main.cpp(55):错误C2653:''map< char,class

std :: basic_string< char, struct std :: char_traits< char>,class

std :: allocator< char,struct std :: less< char>,class s


我是什么我做错了吗?
I''ve the following code:

#include <map>
#include <string>

using std::string;
using std::map;

int sc_main(int ac, char *av[])
{
map<char,stringstart;
map<char,string>::iterator si;
}

When I try to compile it :

main.cpp(55) : error C2653: ''map<char,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char,struct std::less<char>,class s
What I''m doing wrong?



你不知道主要功能的原型。编译你的

代码,我得到:

/usr/lib/crt1.o:在函数`_start'':

(.text + 0x18):对'main'的未定义引用'

collect2:ld返回1退出状态


修复main后,代码编译没有问题。


你遇到的问题与c ++无关。看起来你好吗?
正在使用Windows - 必须是你设置

whatever_you_are_using_to_compile错误。

You do not know the prototype for the main function. Compiling your
code, I got:
/usr/lib/crt1.o: In function `_start'':
(.text+0x18): undefined reference to `main''
collect2: ld returned 1 exit status

After fixing the main, the code compiled without problems.

The problem you are having has nothing to do with c++. Looks like you
are using windows - must be that you set
whatever_you_are_using_to_compile wrongly.


10月24日,上午8:22,Enric< en.nava ... @ gmail.comwrote:
On Oct 24, 8:22 am, Enric <en.nava...@gmail.comwrote:

我有以下代码:

#include< map>

#include< string>


使用std :: string;

使用std :: map;


int sc_main(int ac,char * av [])

{

map< char,stringstart;

map< char,string> :: iterator si;


}


当我尝试编译它:


main.cpp(55):错误C2653:''map< char,class

std :: basic_string< char,struct std :: char_traits< char>,class

std :: allocator< char,struct std :: less< char> ;, class s


我是什么做错了?
I''ve the following code:

#include <map>
#include <string>

using std::string;
using std::map;

int sc_main(int ac, char *av[])
{
map<char,stringstart;
map<char,string>::iterator si;

}

When I try to compile it :

main.cpp(55) : error C2653: ''map<char,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char,struct std::less<char>,class s

What I''m doing wrong?



SystemC与C ++不同。我不知道他们支持STL的支持是多少。您的代码在我的g +

+版本下正确构建。


YT,

Dan Noland
http://nolandda.org/

SystemC is not the same thing as C++. I don''t know what their support
for the STL is like. Your code builds correctly under my version of g+
+.

YT,
Dan Noland
http://nolandda.org/


这篇关于声明地图的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆