Problem compiling Eliza chatbot C++ error LNK2019

2019-07-29 11:57发布

问题:

firstly I would just like to say that I am not a C++ programmer and I never intend to be - I am an SQL, javascript and PHP developer. For a module at Univeristy I have to alter a chatbot project to demonstrate AI and NLP.

While my own exasperation (at being handed an assignment that requires a background knowledge in a subject matter that I have never been taight in my 3 years here) is irrelevant, I am attempting to dive in and learn a bit of C++, as computer logic is, I hope, universal across languages. My point is that I am not knowledgeable in this, and I apologise for that. I have honestly searched for this error (there is a lot) but I don't understand some of the solutions.

Anyway, I am getting these errors when I compile:

1>Eliza.obj : error LNK2019: unresolved external symbol "public: void __thiscall Lex::load(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?load@Lex@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main

1>Eliza.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Lex::partOfSpeech(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?partOfSpeech@Lex@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V23@@Z) referenced in function "void __cdecl showLexValues(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?showLexValues@@YAXAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z)

1>Eliza.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Lex::meaning(void)" (?meaning@Lex@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "void __cdecl showLexValues(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?showLexValues@@YAXAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z)

1>Eliza.obj : error LNK2019: unresolved external symbol "public: bool __thiscall Lex::contains(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?contains@Lex@@QAE_NAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "void __cdecl showLexValues(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > &)" (?showLexValues@@YAXAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z)

1>C:\Users\Minky\Documents\chatbot\Eliza4\Debug\elizav4.exe : fatal error LNK1120: 4 unresolved externals

I have tried changing the subsystem, as I read - this did not work. I have tried looking for the things that I am supposed to link, but I don't know how. I have a new installation of Visual Studio 2005.

Can anyone help me please? I really would like to start making headway on this immediately. Here is the project file http://www.mediafire.com/?3xvnb37449i65x9

This code should work straight out the box, so to speak, as it is the project files that you are supposed to start with and subsequently add to.

With that in mind, do you think there is a problem with my configuration? Are the project files supposed to go somewhere specific so that VS can find and reference libraries or something (I'm clutching at straws here)? As I said, I had found a thread talking about subsystems, which I tried changing, with no joy

I really really need to get crackin on this - again I want to point out I am not trying to learn C++, this project is a tool to demonstrate NLP. So while I realise that there is a reluctance with people to just give people an answer, I am merely trying to get this working so I can get started. I really have searched and yes there are a lot of similiar threads, but I have literally no knowledge of C++ at all, so it is just completely unhelpful to me. I am certain that this is a problem with my configuration or something

Any help would be appreciated

回答1:

Take a look at this: http://msdn.microsoft.com/en-us/library/799kze2z%28v=vs.80%29.aspx

That should probably answer your question. Also, if you are using any code libraries then these are not being linked to correctly.