|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Jul 2006
Città: Palermo
Messaggi: 258
|
[C++] problema compilazione "was not declared in this scope"
Salve a tutti, tengo un problema quando vado a compilare il mio programma. Tengo due funzioni in un file .cpp, però quando vado a compilare esce questo errore " valorMin was not declared in this scope". Però la funziona la vado a definire dopo.
Codice:
double valorMax (const Environment &estado, int jug, Environment::ActionType accion, int limite_profundidad)
{
Environment hijo[4];
int sucesores=estado.GenerateNextMove(hijo,jug);
if ((sucesores==0)||(limite_profundidad==0)) return Heuristica(estado,jug);
double v= -100000000;
for (int i=0; i < sucesores;i++)
v=max(v,valorMin(hijo[i],jug,accion,limite_profundidad-1));
return v;
}
double valorMin (const Environment &estado, int jug, Environment::ActionType accion, int limite_profundidad)
{
Environment hijo[4];
int sucesores=estado.GenerateNextMove(hijo,jug);
if ((sucesores==0)||(limite_profundidad==0)) return Heuristica(estado,jug);
double v= +100000000;
for (int i=0; i < sucesores;i++)
v=min(v,valorMax(hijo[i],jug,accion,limite_profundidad-1));
return v;
}
|
|
|
|
|
|
#2 |
|
Junior Member
Iscritto dal: May 2012
Messaggi: 1
|
Aggiungi i prototipi all'inizio del file, oppure in un header esterno da importare...
Codice:
double valorMin (const Environment &estado, int jug, Environment::ActionType accion, int limite_profundidad); double valorMax (const Environment &estado, int jug, Environment::ActionType accion, int limite_profundidad); |
|
|
|
|
|
#3 | |
|
Member
Iscritto dal: Jul 2006
Città: Palermo
Messaggi: 258
|
Quote:
|
|
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Oct 2005
Messaggi: 3306
|
Undefined reference: mi sa tanto che non stai referenziando una qualche libreria esterna oppure ti sta mancando qualche file cpp.
|
|
|
|
|
|
#5 |
|
Member
Iscritto dal: Jul 2006
Città: Palermo
Messaggi: 258
|
i file .cpp c'erano tutti; ho risolto con un "rebuild", quindi era qualche problema al livello di compilazione..in ogni caso grazie a tutti e due
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 00:25.




















