неопределенная ссылка на PerformChat (char *, char *, char *, char *, char *)

Я хочу использовать ChatScript извне в моей программе. в документы это говорит:

Внедрение Шаг # 1 Сначала вам нужно изменить `common.h и скомпилировать систему. Вам нужно добавить все CS .cpp файлы в ваш список сборки.

Найти // #define NOMAIN 1 и раскомментируйте это. Это позволит вам скомпилировать вашу программу как основную программу, а ChatScript — просто как набор подпрограмм, сопровождающих ее.

Но я новичок в Linux и не могу понять, как добавить файлы .cpp в мой список сборки? Каков мой список сборки? Может кто-нибудь объяснить, что мне делать именно?

Я скопировал все .cpp и .h и другие папки, существующие в каталоге ChatScript / SRC рядом с моим main.cpp в моем проекте.

Затем я попытался запустить этот код:

#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;
}

Но я получаю это сообщение об ошибке:

undefined reference to `PerformChat(char*, char*, char*, char*, char*)

Затем я включил все файлы заголовков в свою программу и удалил следующую строку кода: void PerformChat(char* user,char* usee,char* incoming,char* ip,char* output);

#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()'

3

Решение

Вы должны были бы включить все файлы Chatscript SRC в свой проект, чтобы получить функцию PerformChat для компиляции. Но в скором времени ChatScript также выйдет с библиотечными компиляциями.

1

Другие решения

Других решений пока нет …