Foro de elhacker.net

Programación => Programación C/C++ => Mensaje iniciado por: creiko en 19 Octubre 2016, 07:38 am



Título: [Error] ld returned 1 exit status en mi programa de pilas y colas
Publicado por: creiko en 19 Octubre 2016, 07:38 am
Ola que tal estoy haciendo esto dev c++
pero me sale este error

si alguien me ayuda lo agradeceria

O:\collect2.exe [Error] ld returned 1 exit status


Código
  1.  
  2. #include "stdio.h"
  3. #include "conio.h"
  4. #include "string.h"
  5. #include "windows.h"
  6. #include "stdlib.h"
  7. #include "time.h"
  8. #include "iostream"
  9. #include "stdlib.h"
  10. struct nodo{
  11. int informacion;
  12. struct nodo *siguiente;
  13. };
  14. int menu();
  15. void agregar_nodo();
  16. void listar();
  17. void insertfinal();
  18. nodo *inicio = NULL, *nuevo = NULL, *aux;
  19. main()
  20. {
  21. int opc=0;
  22. while(opc!=8)
  23. {
  24. switch (opc)
  25. {
  26. case 1:
  27. agregar_nodo();
  28. break;
  29.  
  30. case 2:
  31. insertfinal();
  32. break;
  33. case 3:
  34. break;
  35. case 4:
  36. listar();
  37. break;
  38. }
  39. opc=menu();
  40. }
  41. }
  42. int menu()
  43. {
  44. int opc;
  45. printf("\n\n");
  46. printf("1. Agregar elementos al inicio de la lista \n");
  47. printf("2. Agregar elementos al final de la lista \n");
  48. printf("3. Agregar elementos despues de \n");
  49. printf("4. Listar elementos \n");
  50. printf("5. Buscar elementos \n");
  51. printf("6. Eliminar elementos \n");
  52. printf("7. Eliminar lista \n");
  53. printf("8. Fin de la ejecucion \n");
  54. printf("\n\n");
  55. printf("Seleccione una opcion \n");
  56. scanf("%d",&opc);
  57. printf("\n\n");
  58. printf("la opcion elegida es: %d",opc);
  59. printf("\n\n");
  60. return opc;
  61. }
  62. typedef struct nodo *Tlista;
  63. void agregar_nodo()
  64. {
  65. int elem;
  66. printf("ingrese el elemento de la lista \n");
  67. scanf("%d",&elem);
  68. nuevo = new nodo;
  69. nuevo->informacion=elem;
  70. nuevo->siguiente=inicio;
  71. inicio = nuevo;
  72. printf("\n elemento agregado satisfactorimente \n");
  73. }
  74. void listar()
  75. {
  76. aux=inicio;
  77. while(aux!=NULL)
  78. {
  79. printf("\n elemento: %d",aux->informacion);
  80. aux = aux -> siguiente;
  81. }
  82. }
  83. void insertfinal(int elem,nodo *lista)
  84. {
  85. nodo *nuevo, *aux2=lista;
  86. nuevo = new nodo;
  87. nuevo->informacion = elem;
  88. nuevo->siguiente = NULL;
  89. if(aux2 == NULL)
  90. {
  91. lista = nuevo;
  92. }
  93. else
  94. {
  95. while(aux2->siguiente != NULL)
  96. {
  97. aux2 = aux2->siguiente;
  98. }
  99. aux2->siguiente = nuevo;
  100. }
  101. }
  102.  
  103.