字符串无法识别?C4430:缺少类型说明符-假定为int [英] string not recognized? C4430: missing type specifier - int assumed

查看:61
本文介绍了字符串无法识别?C4430:缺少类型说明符-假定为int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定义了此类,但根本无法使用.

I have this class defined but it doesn't work at all.

#ifndef LIBROS_H
#define LIBROS_H
#include "Articulo.h"
class Libros: public Articulo
{
public:
Libros();
~Libros();
string Autor;
string Editorial;
void mostrar();
void llenar();
};
# endif

这给出:错误C4430:缺少类型说明符-假定为int.注意:C ++不支持default-int

this gives: error C4430: missing type specifier - int assumed. Note:C++ does not support default-int

推荐答案

您忘记了 #include 正确的标题.

#include <string>

并且由于您没有 using 语句,因此您需要使用它们所在的命名空间来限定 strings ,这就是 std :

And since you have no using statement, you'll need to qualify your strings with the namespace they're in, which is std:

std::string Autor;
std::string Editorial;

这篇关于字符串无法识别?C4430:缺少类型说明符-假定为int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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