undefined reference to function

Hi
I wrote the following code to :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include "pila.h"
#include "string.h"

using namespace std;

int main()
{
    char ecuacion[50];
    cin.getline(ecuacion, sizeof(ecuacion));

    struct TNodoPila<char> *simbolos;

    CrearPila(&simbolos);

    char *aux=ecuacion;
    int i=strlen(ecuacion);

    while(i>0){

        if(*aux=='{'||*aux=='}'||*aux=='['||*aux==']'||*aux=='('||*aux==')'){

            InsertarPila(&simbolos, *aux);
        }

        i--;
    }
}


When I compiled this, I got this error :

undefined reference to `void CrearPila<char>(TNodoPila<char>**)
undefined reference to `void InsertarPila<char>(TNodoPila<char>**, char)

what's the wrong?, thanks.
Last edited on
so you are receiving errors that voids are undefined? but I do not see any void declarations. Perhaps if you declared CrearPila(&simbolos); before your main program. like this:

void CrearPila(&simbolos);

int main()
{


and maybe do the same with InsertarPila(&simbolos, *aux);





OP wrote:
undefined reference to `void CrearPila<char>(TNodoPila<char>**)
undefined reference to `void InsertarPila<char>(TNodoPila<char>**, char)

Check to see if you've actually implemented the functions.

struct TNodoPila<char> *simbolos;

CrearPila(&simbolos);

1. struct is not needed here, as this is the declaration of a pointer(not in C++, but in C)
2. This may give bad runtime errors, as simbolos is not initialized, but being dereferenced.

Aceix.
Topic archived. No new replies allowed.