Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/07/2015, 20:43
Avatar de ignacio85r
ignacio85r
 
Fecha de Ingreso: mayo-2010
Ubicación: mar del plata
Mensajes: 155
Antigüedad: 13 años, 11 meses
Puntos: 0
Pregunta consulta de errores C

Buenas noches amigos. estoy comenzando a estudiar c para luego pasar a c++.
este es un programa que su codigo comienza siendo programado en C, hasta que el mismo ira evolucionando pase a C++.
El codigo nos paso el profesor del instituto y que no he logrado que compile ya que me devuelve los siguientes errores.
revise la hoja del profesor varias veces y no encuentro diferencias solo que el de el compila y el mio no.

les estare muy agradecido por su colaboracion. muchas gracias!!

errores:
[C++ Error] main.cpp(78): E2451 Undefined symbol 'CollectionResult'
[C++ Error] main.cpp(79): E2451 Undefined symbol 'result'
[C++ Error] main.cpp(82): E2451 Undefined symbol 'LessThanFive'
[C++ Error] main.cpp(87): E2268 Call to undefined function 'select'

Código C:
Ver original
  1. //
  2. //main.cpp
  3. //CollectionRefactoring_04
  4. //
  5. //
  6.  
  7. #include <iostream>
  8. #include "Collection.h"
  9.  
  10. typedef bool ( *Condition )(Type item) ;
  11.  
  12. //
  13. //user defined condition...
  14. //
  15. bool lessThanFive(Type item)
  16. {
  17.         return item < 5 ;
  18. }
  19.  
  20. bool DivisibleByTwo(Type item)
  21. {
  22.         return ( item % 2 == 0 ) ;
  23. }
  24.  
  25. //
  26. //Utility function Dump
  27. //
  28. void CollectionDump( Collection thisCollection )
  29. {
  30.     Type* item = CollectionFirst( thisCollection ) ;
  31.     if( item )
  32.                 {
  33.         std::cout << "Collection ( " <<
  34.                 CollectionCount( thisCollection ) << " items )" << std::endl ;
  35.         while ( item )
  36.               {
  37.             std::cout << ( *item ) << " " ;
  38.             item = CollectionNext( thisCollection ) ;
  39.           }
  40.                   std::cout << std::endl ;
  41.                 }else
  42.         {
  43.             std::cout << " Collection Empty " << std::endl ;
  44.         }
  45.     }
  46.  
  47. //
  48. //Select Function
  49. //
  50. void Select( Collection input, Condition condition, Collection& result )
  51. {
  52.     Type* item = CollectionFirst( input ) ;
  53.     while ( item )
  54.     {
  55.         if ( condition( *item ) ) CollectionAdd( result, *item ) ;
  56.         item = CollectionNext( input ) ;
  57.     }
  58.  
  59. }
  60.  
  61.  
  62. int main(int argc, const char * argv[])
  63. {
  64. Type data[] = {
  65.     2,3,5,9,6,23,4,10,12,44,13,1,22
  66. } ;
  67.  
  68. int sizeOfData = sizeof(data) / sizeof(Type ) ;
  69.  
  70. Collection collection ;
  71. CollectionInitialize( collection ) ;
  72.  
  73. CollectionCreateWith( collection, data, sizeOfData ) ;
  74. CollectionDump( collection ) ;
  75.  
  76. CollectionResult ;
  77. CollectionInitialize( result ) ;
  78. CollectionDump( result ) ;
  79.  
  80. Select ( collection, LessThanFive, result ) ;
  81.  
  82. CollectionDump( result );
  83.  
  84. CollectionRelease( result ) ;
  85. select( collection, DivisibleByTwo, result ) ;
  86. CollectionDump( result ) ;
  87.  
  88.       return 0;
  89. }
__________________
Los manuales existen por un motivo... explicar el funcionamiento de algo. ;-)