C++ 对“PerformChat(char*,char*,char*,char*,char*)的未定义引用

C++ 对“PerformChat(char*,char*,char*,char*,char*)的未定义引用,c++,compilation,chatscript,C++,Compilation,Chatscript,我想在我的程序外部使用ChatScript。在报告中说: 嵌入步骤#1首先,您需要修改`common.h并编译系统。您需要将所有CS.cpp文件添加到生成列表中。 在1中找到/#define noma并取消注释。这将允许您将程序编译为主程序,而将ChatScript编译为附带的例程集合 但我是Linux新手,不知道如何将.cpp文件添加到构建列表中?我的构建列表是什么?有人能解释一下我该怎么做吗 我确实复制了项目中main.cpp旁边ChatScript/SRC目录中存在的所有.cpp和.h文件

我想在我的程序外部使用ChatScript。在报告中说:

嵌入步骤#1首先,您需要修改`common.h并编译系统。您需要将所有CS.cpp文件添加到生成列表中。 在1中找到
/#define noma并取消注释。这将允许您将程序编译为主程序,而将ChatScript编译为附带的例程集合

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

我确实复制了项目中main.cpp旁边ChatScript/SRC目录中存在的所有.cpp和.h文件夹以及其他文件夹

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

#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;
    }
然后我将所有头文件都包含到我的程序中,并删除了这行代码:
void PerformChat(char*user,char*usee,char*incoming,char*ip,char*output)


您必须在项目中包含所有chatscript SRC文件,才能获得要编译的函数PerformChat。但很快ChatScript也将与库编译一起发布。

Uh-oh。这个源代码包附带了一个Makefile,它只支持构建可执行文件,而不支持构建库,而且我看不到任何适合将其用作库的头文件。这恐怕不会很简单。@aschepler:但上面说的是
在1中找到//#define NOMAIN并取消注释。这将允许您将程序编译为主程序,而ChatScript仅作为一组例程随附。
您的意思是我必须这样做#包括我的主函数上方的所有.h文件(以下#包括)?您可以解释一下您的简短部分吗
ChatScript也将随库编译一起发布。
我添加了所有头文件,但出现了新错误:
错误:C函数'int main()的声明冲突。
我想正如教程所说,我必须在外部使用ChatScript之前编译它,但我不能这样做:(ChatScript Releases将来将附带一个DLL供使用。
undefined reference to `PerformChat(char*, char*, char*, char*, char*)
#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;
    }
error: conflicting declaration of C function ‘int main()'