Witam!
Jestem w trakcie przerabiania książki Bjarne'a Staroustrup'a Programming -- Principles and Practice Using C++. Dobrnąłem do działu 6. w którym wprowadzane są tokeny i używanie typu użytkownika. Chciałem poćwiczyć sobie na książkowym kodzie, ale gdy próbowałem go skompilować uzyskałem poniższe błędy:
Error LNK1120 1 unresolved externals Token_type C:\Users\admin\source\repos\Token_type\Debug\Token_type.exe 1
Error LNK2019 unresolved external symbol "class Token __cdecl get_token(void)" (?get_token@@YA?AVToken@@XZ) referenced in function _main Token_type C:\Users\admin\source\repos\Token_type\Token_type.obj 1
A tak wygląda całość.
#include "pch.h"
#include <iostream>
#include <vector>
class Token{
public:
char kind; // what kind of token
double value; // for numbers: a value
Token(char ch) // make a Token from a char
:kind(ch), value(0) { }
Token(char ch, double val) // make a Token from a char and a double
:kind(ch), value(val) { }
};
Token get_token();
std::vector<Token> tok;
int main()
{
while (std::cin) {
Token t = get_token();
tok.push_back(t);
}
for (int i = 0; i < tok.size(); ++i) {
if (tok[i].kind == '*') {
double d = tok[i - 1].value*tok[i + 1].value;
}
}
}
Jestem pewien, że dotyczą one tego fragmentu
while (std::cin) {
Token t = get_token();
tok.push_back(t);
}
Jednakże nie mam pojęcia jak to naprawić i w ogóle co może być nie tak, jako, że treść błędów niewiele mi mówi. ;) Z góry dziękuję.