首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未定义的对` `PerformChat(char*,char*)的引用

未定义的对` `PerformChat(char*,char*)的引用
EN

Stack Overflow用户
提问于 2017-10-13 07:23:39
回答 1查看 398关注 0票数 3

我想在我的程序中外部使用ChatScript。在文档中,它说:

嵌入步骤1首先,您需要修改common.h and compile the system. You need to add all the CS .cpp files to your build list. Find the// #定义NOMAIN 1‘并取消注释。这将允许您将您的程序编译为主程序,而ChatScript仅作为与其配套的例程的集合。

但是我是Linux的新手,不知道如何将.cpp文件添加到我的构建列表中?我的建造清单是什么?有人能解释一下我应该做什么吗?

在我的项目中,除了我的.cpp和.h目录之外,我还复制了ChatScript/SRC目录中的所有main.cpp和.h以及其他文件夹。

然后我试着运行以下代码:

代码语言:javascript
复制
#include<iostream>
using namespace std;

char* output2;
    unsigned int InitSystem(int argc,char* argv[],char* unchangedPath,char* readonlyPath,char* writablePath);
    void InitStandalone();
    void PerformChat(char* user,char* usee,char* incoming,char* ip,char* output);

    int main()
    {

    PerformChat(NULL,NULL,"hi",NULL,output2);

    cout<<output2;

        return 0;
    }

但我得到了一条错误信息:

代码语言:javascript
复制
undefined reference to `PerformChat(char*, char*, char*, char*, char*)

然后,我将所有的头文件都包含到我的程序中,并删除了这一行代码:void PerformChat(char* user,char* usee,char* incoming,char* ip,char* output);

代码语言:javascript
复制
#include<iostream>

#include "common.h"
#include "common1.h"
#include "constructCode.h"
#include "cs_ev.h"
#include "csocket.h"
#include "dictionaryMore.h"
#include "dictionarySystem.h"
#include "english.h"
#include "evserver.h"
#include "factSystem.h"
#include "functionExecute.h"
#include "infer.h"
#include "jsmn.h"
#include "json.h"
#include "mainSystem.h"
#include "markSystem.h"
#include "mongodb.h"
#include "mprintf.h"
#include "multi.h"
#include "my_sql.h"
#include "os.h"
#include "outputSystem.h"
#include "patternSystem.h"
#include "postgres.h"
#include "privatesrc.h"
#include "scriptCompile.h"
#include "spellcheck.h"
#include "systemVariables.h"
#include "tagger.h"
#include "testing.h"
#include "textUtilities.h"
#include "tokenSystem.h"
#include "topicSystem.h"
#include "userCache.h"
#include "userSystem.h"
#include "variableSystem.h"

using namespace std;

char* output2;
    unsigned int InitSystem(int argc,char* argv[],char* unchangedPath,char* readonlyPath,char* writablePath);
    void InitStandalone();
    void PerformChat(char* user,char* usee,char* incoming,char* ip,char* output);

    int main()
    {

    PerformChat(NULL,NULL,"hi",NULL,output2);

    cout<<output2;

        return 0;
    }

但新的错误是:

代码语言:javascript
复制
error: conflicting declaration of C function ‘int main()'
EN

回答 1

Stack Overflow用户

发布于 2017-10-15 16:01:57

您必须在项目中包含所有聊天脚本SRC文件,才能编译函数PerformChat。但是不久,ChatScript也将发布库编译。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46749399

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档