0

ライブラリをコンパイルしようとしていますが、実行make中に次のエラーの多くが発生します。

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関数\メソッドでは、変換するint x必要がありますか、それともエラーの原因ですかint aint wtv

ライブラリの作成者は多くの関数でText* xandを使用しているので、int xおそらく彼は自分が何をしているかを知っており、ポインターが である可能性があるとint思いました.

無関係: ライブラリは、中国語のテキスト分析エンジンである Adso です。

4

2 に答える 2

1

次のような宣言に「x」という名前の2つのパラメーターがあります。

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

それらの1つに別の名前を付けてください。例えば:

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

著者はあまり上手ではなかったので、他のエラーにも注意してください。

于 2012-11-18T12:07:59.637 に答える
0

問題は、私的な機能だけでanalyse_codeなく、すべての私的機能にあります。ソース コード (.c ファイル) がある場合は、そこでも確認します。

とにかく、を次のText *xようなものに変更する必要がありますText *text

于 2012-11-18T12:21:55.147 に答える