C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need a help on this compiler driver

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Inglid Felix
Guest





PostPosted: Fri Dec 12, 2003 9:51 am    Post subject: Need a help on this compiler driver Reply with quote



Can someone look at my compiler driver and tell me why is not working.
Please let me know what I need to do to make it work. Thanks.

//calculator.cpp

#include "symboltable.h"
#include "scanner.h"
#include "parser.h"
#include <iostream>

using std::cin;
using std::cout;

int main()
{
Symbol("pi") = 3.1415926535897932385;
Symbol("e") = 2.7182818284590452354;

while(cin)
{
GetToken();
if(currentToken == END) break;
if(currentToken == PRINT) continue;
cout << Expression(false) << 'n';
}
}

---------------------------------------------
Here is the error that I am getting:

Compiling...
calculator.cpp
c:testscannerandparsercalculator.cpp(23) : warning C4508: 'main' :
function should return a value; 'void' return type assumed
Linking...
calculator.obj : error LNK2001: unresolved external symbol "double
__cdecl Expression(bool)" (?Expression@@YAN_N@Z)
calculator.obj : error LNK2001: unresolved external symbol "enum Token
currentToken" (?currentToken@@3W4Token@@A)
calculator.obj : error LNK2001: unresolved external symbol "enum Token
__cdecl GetToken(void)" (?GetToken@@YA?AW4Token@@XZ)
calculator.obj : error LNK2001: unresolved external symbol "double &
__cdecl Symbol(class std::basic_string std::char_traits)"
(?Symbol@@YAAANV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std
@@@Z)
Debug/calculator.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.

calculator.exe - 5 error(s), 1 warning(s)

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Francis Glassborow
Guest





PostPosted: Fri Dec 12, 2003 6:31 pm    Post subject: Re: Need a help on this compiler driver Reply with quote



In article <b2349c95.0312111937.66098799 (AT) posting (DOT) google.com>, Inglid
Felix <ingafe (AT) hotmail (DOT) com> writes
Quote:
Can someone look at my compiler driver and tell me why is not working.
Please let me know what I need to do to make it work. Thanks.

//calculator.cpp

#include "symboltable.h"
#include "scanner.h"
#include "parser.h"

As the above form part of the context of the following we cannot see
what the compiler sees.

Quote:
#include
using std::cin;
using std::cout;

int main()
{
Symbol("pi") = 3.1415926535897932385;
Symbol("e") = 2.7182818284590452354;

Is an understanding of these lines necessary to your question? Can't
they simply be omitted?

Quote:

while(cin)

So how do you intend to end input? If input can fail I think that should
be explicitly handled, if it cannot then use while(true) to signify that
the loop has an internal break.

Quote:
{
GetToken();
if(currentToken == END) break;
if(currentToken == PRINT) continue;

To understand a failure to compile the above we would need to know more
than you have shown.

Quote:
cout << Expression(false) << 'n';
}
}

---------------------------------------------
Here is the error that I am getting:

Compiling...
calculator.cpp
c:testscannerandparsercalculator.cpp(23) : warning C4508: 'main' :
function should return a value; 'void' return type assumed

So you are not using a conforming compiler (Looks like one of the
earlier versions of VC++)

Quote:
Linking...

This has nothing to do with compilation but is complaining that you have
reneged on the promises made in your header files where various things
were declared. Looks like you have not provided relevant implementation
files for the things declared or classes defined in your header files.

--
Francis Glassborow ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
or http://www.robinton.demon.co.uk


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Tom
Guest





PostPosted: Sat Dec 13, 2003 2:21 am    Post subject: Re: Need a help on this compiler driver Reply with quote



[email]ingafe (AT) hotmail (DOT) com[/email] (Inglid Felix) wrote:

Quote:
Can someone look at my compiler driver and tell me why is not working.

Short answer: because you haven't provided code for "symboltable.h",
"scanner.h", or "parser.h"

Quote:
Please let me know what I need to do to make it work.

Short answer: provide working code for "symboltable.h", "scanner.h",
or "parser.h"

Longer answer below.

Quote:
//calculator.cpp

#include "symboltable.h"

What is this?

Quote:
#include "scanner.h"

What is this?

Quote:
#include "parser.h"

What is this?

Quote:
#include <iostream

using std::cin;
using std::cout;

int main()
{
Symbol("pi") = 3.1415926535897932385;
Symbol("e") = 2.7182818284590452354;

What is a Symbol? Where is it defined?

Quote:
while(cin)
{
GetToken();

What is GetToken()? Where is it defined?

Quote:
if(currentToken == END) break;

What is currentToken? Where is it defined? What is END? Where is it
defined?

Quote:
if(currentToken == PRINT) continue;

What is PRINT? Where is it defined?

Quote:
cout << Expression(false) << 'n';

What is Expression(bool)? Where is it defined?

Quote:
}
}

---------------------------------------------
Here is the error that I am getting:

Compiling...
calculator.cpp
c:testscannerandparsercalculator.cpp(23) : warning C4508: 'main' :
function should return a value;

What compiler are you using? It should not generate this warning, but
perhaps there is something in one of the headers that you have chosen
not to share with us that is causing this to occur.

Quote:
'void' return type assumed
Linking...
calculator.obj : error LNK2001: unresolved external symbol "double
__cdecl Expression(bool)" (?Expression@@YAN_N@Z)

Here the linker is asking you "where is Expression(bool) defined?" So
what's the answer?

Quote:
calculator.obj : error LNK2001: unresolved external symbol "enum Token
currentToken" (?currentToken@@3W4Token@@A)

Here the linker is asking you "Where is enum Token currentToken
defined?" What's your answer?

Quote:
calculator.obj : error LNK2001: unresolved external symbol "enum Token
__cdecl GetToken(void)" (?GetToken@@YA?AW4Token@@XZ)

Here the linker is asking you "Where is enum Token GetToken()
defined?" What's the answer?

Quote:
calculator.obj : error LNK2001: unresolved external symbol "double &
__cdecl Symbol(class std::basic_string std::char_traits)"
(?Symbol@@YAAANV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std
@@@Z)

And here the linker is asking you - not particularly articulately -
"Where is the definition for Symbol(std::string)?" And where is it?

Quote:
Debug/calculator.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.

calculator.exe - 5 error(s), 1 warning(s)

There's an FAQ that will help you out quite a bit, I think. Take a
look at:

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8

I think you'll find items 1, 2, 4, 5, and 6 to be particularly
pertinent.

Best regards,

Tom

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.