[C++] Errore "should have been declared"

Messaggioda Amabuzi » 26/04/2018, 12:36

Ho un problema, sto implementando una serie di funzioni per far funzionare un dizionario basato su alberi di ricerca binari, ho scritto tutto e quando compilo mi da il seguente errore:
"should have been declared inside dict" con le funzioni insertElem, deleteElem, print, search e createEmptyDict.
Metto di seguito il codice che ho scritto nel file header per una maggiore comprensione dell'errore, spero possiate aiutarmi.

#include <iostream>
#include <stdexcept>
#include <vector>
#include <fstream>
#include <chrono>
#include <stdlib.h>
#include <string>

#include "string-utility.h"

using namespace std::chrono;
using namespace std;

namespace dict {

//Casi di errore

enum Error {OK, FAIL};

//Tipi e Costanti

const int tableDim = 1000; //da modificare per esperimenti diversi

typedef string Key; //tipo base
typedef string Value; //tipo base

const Key emptyKey = "###RESERVED KEYWORD### EMPTY KEY"
const Value emptyValue = "###RESERVED KEYWORD### EMPTY VALUE"

typedef struct {
Key key;
Value value;
} Elem;

struct AlBST {
Elem e;
AlBST *lchild, *rchild, *father;
};
typedef AlBST* Dictionary;

struct t_stack {
Dictionary val;
t_stack *next;
};
typedef t_stack *ptr_stack;

Error insertElem(const Key, const Value, const Dictionary&);
Error deleteElem(const Key, const Dictionary&);
Value search(const Key, const Dictionary&);
Dictionary createEmptyDict();
void print (const Dictionary&);
}

Grazie mille per il tempo che mi dedicherete.
Amabuzi
Starting Member
Starting Member
 
Messaggio: 1 di 2
Iscritto il: 26/04/2018, 12:26

Re: [C++] Errore "should have been declared"

Messaggioda claudio86 » 26/04/2018, 15:27

A parte i punti e virgola dopo le due costanti, e commentando la linea #include "string-utility.h", compila tranquillamente. Sarebbe utile che mostrassi tutto il sorgente e soprattutto tutto l'output del compilatore.
"This theorem, as many others, is proven by writing zero in a creative way…"
claudio86
Senior Member
Senior Member
 
Messaggio: 483 di 1130
Iscritto il: 09/01/2011, 15:12


Torna a Informatica

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite