-4

Im Displaying This Error: nested functions are disabled, use -fnested-functions to re-enable ,Im running on a MAC what are your thoughts on what causes it?

This is a program that makes a list with clients and sales. It finds a client, erase them and

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "clientes.h"


int ordena(LISTA1 *inicio,LISTA1 *aux,LISTA1 *nodo,LISTA1 *aux2);
int agrega_cliente(LISTA1 *inicio, LISTA1*aux,LISTA1 *nodo,LISTA1 *aux2);
int busca_cliente(LISTA1 *inicio, LISTA1*aux,LISTA1 *nodo,LISTA1 *aux2,LISTA2         *inicioventas,LISTA2 *auxventas,LISTA2 *nodoventas,LISTA2 *aux2ventas);
extern void agrega_nombre();
int main(void)
{
 int menu,pops=0;
LISTA1 *inicio, *aux,*nodo, *aux2;
inicio=NULL;
aux=inicio;
LISTA2 *inicioventas, *auxventas,*nodoventas, *aux2ventas;
 system("clear");
  //funcion void carga_datos(); 
ordena(inicio,aux,nodo,aux2);

 printf("TIENDA DEPARTAMENTAL\n\n\n");
  printf("1. Agregar a un Cliente.\n2. Agregar una venta.\n3. Buscar Cliente. \n4. Borrar       Cliente. \n5. Borrar una venta. \n6. Salir.");
printf("\n\nElige una opcion: "); 
   scanf("%d", &menu);
 switch(menu)
{
 case 1:
  system("clear");
  printf("opcion1\n");
        agrega_cliente(inicio,aux,nodo,aux2);

  break;
  case 2:
  system("clear");
  printf("opcion2\n");
  break;
case 3:
  system("clear");
  printf("opcion3\n");

        busca_cliente(inicio,aux,nodo,aux2,inicioventas, auxventas, nodoventas, aux2ventas);
        puts(aux2->nombre);

  break;
case 4:
  system("clear");
  printf("opcion4\n");
  break;
case 5:
  system("clear");
  printf("opcion5\n");
  break;
case 6:
  system("clear");
  printf("opcion6\n");
  break;
}
}

///Funcion Busqueda
 int busca_cliente(LISTA1 *inicio, LISTA1 *aux,LISTA1 *nodo,LISTA1 *aux2,LISTA2    *inicioventas,LISTA2 *auxventas,LISTA2 *nodoventas,LISTA2 *aux2ventas)
 {
    char nombrebusqueda[80];
int numclienteprueba;
printf("Dame el nombre del cliente a buscar\n");
scanf("%s",nombrebusqueda);
aux2=aux; 
while(aux2!=NULL)
{ 
    if((strcmp(nombrebusqueda,aux2->nombre))==0)
    {
        puts(aux2->nombre);
        ////////Buscamos la venta
        aux2ventas=aux; 
        while(aux2ventas!=NULL)
        {
            numclienteprueba=aux2ventas->num_clienteventas;
            if(numclienteprueba==aux2ventas->num_clienteventas)
            {
                printf("Wow");
        }
        ////////////
    }
    aux2=aux2->sig;
}
 }

 ////////////////////////////////////////////Funcion Ordena



 int ordena(LISTA1 *inicio, LISTA1*aux,LISTA1 *nodo,LISTA1 *aux2)
 {
char pruebaman[80],probaman[80];//nombres
char pruebadireccion[150],probadireccion[150];//direccion
int pruebanum_cliente,probanum_cliente;//numero de cliente
aux2=aux;
strcpy(pruebaman,aux2->nombre);
strcpy(pruebadireccion,aux2->direccion);
pruebanum_cliente=aux2->num_cliente;
aux2=aux2->ant;

do
   {

    strcpy(probaman,aux2->nombre);

    if(pruebaman[0]<probaman[0])
    {
        strcpy(pruebaman,aux2->nombre);
        strcpy(pruebadireccion,aux2->direccion);
        pruebanum_cliente=aux2->num_cliente;
        aux2=aux2->sig;
        strcpy(aux2->nombre,probaman); 
        strcpy(aux2->direccion,probadireccion);
        probanum_cliente=aux2->num_cliente;    
    }
    strcpy(pruebaman,aux2->nombre);
    strcpy(pruebadireccion,aux2->direccion);
    pruebanum_cliente=aux2->num_cliente;

    aux2=aux2->ant;


    printf("Ciclo\n\n");

}
while(aux2!=NULL);
aux2=aux;
strcpy(pruebaman,aux2->nombre);
aux2=aux2->ant;
strcpy(probaman,aux2->nombre);
if(pruebaman[0]<probaman[0])
    ordena(inicio,aux,nodo,aux2);
 } 



 ///////////////////////////////////////////////////////Agrega Cliente
 int agrega_cliente(LISTA1 *inicio, LISTA1*aux,LISTA1 *nodo,LISTA1 *aux2)
  {

FILE *clientes;
clientes=fopen("clientes.txt", "a+");
//fseek(clientes, 0L, SEEK_END);

inicio=NULL;
nodo=malloc(sizeof(LISTA1));
aux=malloc(sizeof(LISTA1));

if(nodo==NULL)
{
    printf("No hay memoria\n");
    exit(1);
}
printf("NOMBRE: ");
gets(nodo->nombre);
printf("DIRECCION: ");
gets(nodo->direccion);
printf("NUMERO DE CLIENTE: ");
scanf("%d", &nodo->num_cliente);

if(inicio==NULL)
{
    inicio=nodo;
    inicio->sig=NULL;
    inicio->ant=NULL;
    aux=inicio;
}
else
{
    aux->sig =nodo;
    nodo->ant=aux;
    aux=nodo;
    nodo->sig=NULL;
}
nodo=malloc(sizeof(LISTA1));

aux2=inicio;

while(aux2!=NULL)
{
    fprintf(clientes, "%s\n", aux2->nombre);
    fprintf(clientes, "%s\n", aux2->direccion);
    fprintf(clientes, "%d\n", aux2->num_cliente);
    puts(aux2->nombre);
    puts(aux2->direccion);
    aux2=aux2->sig;
}


aux2=aux;
do
{
    puts(aux2->nombre);
    aux2=aux2->ant;
}
while(aux2!=NULL);
fclose(clientes);
  }
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
drodri420
  • 191
  • 2
  • 6
  • 14
  • 3
    Does this code (intentionally) use nested functions? The indentation and placement of brackets is so haphazard that I can't even tell. – Daniel Pryden Oct 14 '11 at 01:07
  • 1
    Your code is unreadable. Use a consistent indenting style: http://en.wikipedia.org/wiki/Indent_style Your editor may be able to do this for you. Chances are, you'll discover your mistake in the process of fixing the indentation. – bdonlan Oct 14 '11 at 01:25
  • Bad indentation is the cause of this error. – aib Oct 14 '11 at 01:27
  • If your editor *can't* do this for you, you probably want to find a better editor. – Cascabel Oct 14 '11 at 01:27
  • 1
    Before you are too hard on the guy, consider that his code probably has better indentation than it looks, he is just new to stack overflow and doesn't know how to properly use code formatting. – morningstar Oct 14 '11 at 07:16

1 Answers1

2

You are missing the closing bracket at the end of busca_cliente(). How did I find out? I pasted your code into http://www.prettyprinter.de/module.php?name=PrettyPrinter so that it was easy to read.

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • Hahahaha yeah Im new to stack overflow's way to indent a code... but yeah I hate not having my glasses around.. Thank you veryy much! – drodri420 Oct 14 '11 at 12:47