-5

C++ code of my compiler There is only one .cpp file in my Win32 console project. I am facing these LNK compile-time errors in my code. I am working on Visual Studio 12. I have tried a lot of things but nothing seems to have solved my issue.

I am writing code for a compiler that was originally built in Java and now the task at hand is to convert it in C++. I am looking forward to some useful solutions. Can anyone help me with this task?

Error Message

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
  • 6
    You really need to copy and paste the text of the actual error messages so that we can see exactly what it says. – Jerry Jeremiah Dec 05 '17 at 21:15
  • 1
    Here is the documentation page for LNK2019 and LNK1120: https://msdn.microsoft.com/en-us/library/799kze2z.aspx https://msdn.microsoft.com/en-us/library/z98k84c3.aspx – Jerry Jeremiah Dec 05 '17 at 21:16
  • There are lots of errors. 1) main doesn't return void 2) you haven't defined lex() anywhere 3) `out_parser<"error not occured\n";` and `out_parser<"error occured\n";` aren't valid (it should be `<<`) – Jerry Jeremiah Dec 05 '17 at 21:22
  • I have update the question and attached a screenshot of error @JerryJeremiah – Muneeb Ud Deen Dec 05 '17 at 21:47
  • I did not find the solution to my specific problem in already posted questions. They are related to multiple files where there are dependencies issues etc. My code only has one file so there shouldn't be any link error. I am confused – Muneeb Ud Deen Dec 05 '17 at 21:48
  • I need help removing this error as I have to submit this project in a few hours. I'll be thankful – Muneeb Ud Deen Dec 05 '17 at 21:52

2 Answers2

2

From the documentation:

unresolved external symbol 'symbol' referenced in function 'function'

The compiled code for function makes a reference or call to symbol, but that symbol isn't defined in any of the libraries or object files specified to the linker.

This error message is followed by fatal error LNK1120. You must fix all LNK2001 and LNK2019 errors to fix error LNK1120.

You are referencing something not in the file that you are not linking to.

Community
  • 1
  • 1
rioki
  • 5,988
  • 5
  • 32
  • 55
1

The specific error in the screenshot says that the string terminalEP(void) function being called from the terminalP function does not exist - and it is true because your terminalEP function is definaed as string terminalEP(string str) but the line that calls it from the terminalP function is s=terminalEP();

You need to pass a parameter to the terminalEP function or you need to make the parameter for the terminalEP function have a default value.

Jerry Jeremiah
  • 9,045
  • 2
  • 23
  • 32