错误:冲突的声明 - 不能指针是一个int? [英] error: conflicting declaration - cant a pointer be an int?

查看:403
本文介绍了错误:冲突的声明 - 不能指针是一个int?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译一个库,当运行 make 时会出现以下错误:

I am trying to compile a library, when running make I get many of the following errors:

error: conflicting declaration ‘int x’
error: ‘x’ has a previous declaration as ‘Text* x’

这里是代码:

.
.
.
class Text;
class Code {

    private:
            std::vector<std::string> *tokens;
            std::vector<std::string> *compounds;
            std::vector<std::string> *compound_xml;
            std::vector<std::string> *compound_xml_action;
            void set_helper(Text *x, int a, int b, int c, std::string field, std::string value);
            std::string itoa(int x);

    public:
            Code();
            ~Code();

            int analyse_code(Text *x, std::string c, int x, int y, int z);
            int print(Text *x, std::string c, int x, int y, int z);
            int is_class(Text *x, std::string c, int x, int y, int z);
            int is_class2(Text *x, std::string c, int x, int y, int z);
            int not_class(Text *x, std::string c, int x, int y, int z);

 .
 .
 .

所以在 analyse_code function\method,应该将 int x 转换为 int a int wtv 因为库的作者使用了 Text * x

so in analyse_code function\method, should I convert int x to int a or int wtv or is it smth else causing the error?

code> int x 在许多函数中,我想也许他知道他在做什么,指针可以 int 他知道他在做什么?

since the author of the library has used Text* x and int x in many functions, I thought maybe he knows what he's doing and pointers can be int, or am I wrong thinking he knows what he is doing?

不相关:图书馆是一个中文文本分析引擎Adso。

Irrelevant: The library is Adso, a Chinese text analysis engine.

推荐答案

在声明中有两个名为x的参数:

You have two parameters named 'x' in declaration like that:

int not_class(Text *x, std::string c, int x, int y, int z);

将其中一个命名为别的。例如:

Name one of them something else. For example:

int not_class(Text *txt, std::string c, int x, int y, int z);

作者不是很好,所以请小心其他错误。

The author was not very good, so beware other errors too.

这篇关于错误:冲突的声明 - 不能指针是一个int?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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