elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


  Mostrar Mensajes
Páginas: 1 2 [3] 4 5
21  Programación / Programación C/C++ / Re: Error: Unvalid reference to en: 29 Noviembre 2015, 21:47 pm
He pasado lo que acabo de compilar en consola arriba, tengo dos proyectos distintos pero la libreria de una la uso en otro, hay algun problema en eso??
El proyecto modtiempo y modherramientas estan en la misma carpeta, con utilizar esto en el modulo de herrmientas debería de bastar no??
#include "../ModTiempo/tiempo.h"
22  Programación / Programación C/C++ / Re: Error: Unvalid reference to en: 29 Noviembre 2015, 21:38 pm
Compilando desde consola me salta este error:
https://gyazo.com/6537c560794c390e48b400f9e4bc0842
En el makefile del workspace me pone esto:
.PHONY: clean All

All:
   @echo "----------Building project:[ ModHerramientas - Debug ]----------"
   @cd "ModHerramientas" && "$(MAKE)" -f  "ModHerramientas.mk"
clean:
   @echo "----------Cleaning project:[ ModHerramientas - Debug ]----------"
   @cd "ModHerramientas" && "$(MAKE)" -f  "ModHerramientas.mk" clean
Y este es el mk de herramientas project:
##
## Auto Generated makefile by CodeLite IDE
## any manual changes will be erased      
##
## Debug
ProjectName            :=ModHerramientas
ConfigurationName      :=Debug
WorkspacePath          := "C:\Users\Guillermo\Desktop\trabajos"
ProjectPath            := "C:\Users\Guillermo\Desktop\trabajos\ModHerramientas"
IntermediateDirectory  :=./Debug
OutDir                 := $(IntermediateDirectory)
CurrentFileName        :=
CurrentFilePath        :=
CurrentFileFullPath    :=
User                   :=Guillermo
Date                   :=29/11/2015
CodeLitePath           :="C:\Program Files\CodeLite"
LinkerName             :=g++
SharedObjectLinkerName :=g++ -shared -fPIC
ObjectSuffix           :=.o
DependSuffix           :=.o.d
PreprocessSuffix       :=.o.i
DebugSwitch            :=-gstab
IncludeSwitch          :=-I
LibrarySwitch          :=-l
OutputSwitch           :=-o
LibraryPathSwitch      :=-L
PreprocessorSwitch     :=-D
SourceSwitch           :=-c
OutputFile             :=$(IntermediateDirectory)/$(ProjectName)
Preprocessors          :=
ObjectSwitch           :=-o
ArchiveOutputSwitch    :=
PreprocessOnlySwitch   :=-E
ObjectsFileList        :="ModHerramientas.txt"
PCHCompileFlags        :=
MakeDirCommand         :=makedir
RcCmpOptions           :=
RcCompilerName         :=windres
LinkOptions            :=  
IncludePath            :=  $(IncludeSwitch). $(IncludeSwitch).
IncludePCH             :=
RcIncludePath          :=
Libs                   :=
ArLibs                 :=  
LibPath                := $(LibraryPathSwitch).

##
## Common variables
## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables
##
AR       := ar rcus
CXX      := g++
CC       := gcc
CXXFLAGS :=  -g -O0 -Wall $(Preprocessors)
CFLAGS   :=  -g -O0 -Wall $(Preprocessors)
ASFLAGS  :=
AS       := as


##
## User defined environment variables
##
CodeLiteDir:=C:\Program Files\CodeLite
Objects0=$(IntermediateDirectory)/herramientas.cpp$(ObjectSuffix) $(IntermediateDirectory)/main.cpp$(ObjectSuffix)



Objects=$(Objects0)

##
## Main Build Targets
##
.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs
all: $(OutputFile)

$(OutputFile): $(IntermediateDirectory)/.d $(Objects)
   @$(MakeDirCommand) $(@D)
   @echo "" > $(IntermediateDirectory)/.d
   @echo $(Objects0)  > $(ObjectsFileList)
   $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions)

MakeIntermediateDirs:
   @$(MakeDirCommand) "./Debug"


$(IntermediateDirectory)/.d:
   @$(MakeDirCommand) "./Debug"

PreBuild:


##
## Objects
##
$(IntermediateDirectory)/herramientas.cpp$(ObjectSuffix): herramientas.cpp $(IntermediateDirectory)/herramientas.cpp$(DependSuffix)
   $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/herramientas.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/herramientas.cpp$(DependSuffix): herramientas.cpp
   @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/herramientas.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/herramientas.cpp$(DependSuffix) -MM "herramientas.cpp"

$(IntermediateDirectory)/herramientas.cpp$(PreprocessSuffix): herramientas.cpp
   @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/herramientas.cpp$(PreprocessSuffix) "herramientas.cpp"

$(IntermediateDirectory)/main.cpp$(ObjectSuffix): main.cpp $(IntermediateDirectory)/main.cpp$(DependSuffix)
   $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/main.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/main.cpp$(DependSuffix): main.cpp
   @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/main.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/main.cpp$(DependSuffix) -MM "main.cpp"

$(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp
   @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/main.cpp$(PreprocessSuffix) "main.cpp"


-include $(IntermediateDirectory)/*$(DependSuffix)
##
## Clean
##
clean:
   $(RM) -r ./Debug/

El de tiempo:
##
## Auto Generated makefile by CodeLite IDE
## any manual changes will be erased      
##
## Debug
ProjectName            :=ModTiempo
ConfigurationName      :=Debug
WorkspacePath          := "C:\Users\Guillermo\Desktop\trabajos"
ProjectPath            := "C:\Users\Guillermo\Desktop\trabajos\ModTiempo"
IntermediateDirectory  :=./Debug
OutDir                 := $(IntermediateDirectory)
CurrentFileName        :=
CurrentFilePath        :=
CurrentFileFullPath    :=
User                   :=Guillermo
Date                   :=29/11/2015
CodeLitePath           :="C:\Program Files\CodeLite"
LinkerName             :=g++
SharedObjectLinkerName :=g++ -shared -fPIC
ObjectSuffix           :=.o
DependSuffix           :=.o.d
PreprocessSuffix       :=.o.i
DebugSwitch            :=-gstab
IncludeSwitch          :=-I
LibrarySwitch          :=-l
OutputSwitch           :=-o
LibraryPathSwitch      :=-L
PreprocessorSwitch     :=-D
SourceSwitch           :=-c
OutputFile             :=$(IntermediateDirectory)/$(ProjectName)
Preprocessors          :=
ObjectSwitch           :=-o
ArchiveOutputSwitch    :=
PreprocessOnlySwitch   :=-E
ObjectsFileList        :="ModTiempo.txt"
PCHCompileFlags        :=
MakeDirCommand         :=makedir
RcCmpOptions           :=
RcCompilerName         :=windres
LinkOptions            :=  
IncludePath            :=  $(IncludeSwitch). $(IncludeSwitch).
IncludePCH             :=
RcIncludePath          :=
Libs                   :=
ArLibs                 :=  
LibPath                := $(LibraryPathSwitch).

##
## Common variables
## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables
##
AR       := ar rcus
CXX      := g++
CC       := gcc
CXXFLAGS :=  -g -O0 -Wall $(Preprocessors)
CFLAGS   :=  -g -O0 -Wall $(Preprocessors)
ASFLAGS  :=
AS       := as


##
## User defined environment variables
##
CodeLiteDir:=C:\Program Files\CodeLite
Objects0=$(IntermediateDirectory)/tiempo.cpp$(ObjectSuffix)



Objects=$(Objects0)

##
## Main Build Targets
##
.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs
all: $(OutputFile)

$(OutputFile): $(IntermediateDirectory)/.d $(Objects)
   @$(MakeDirCommand) $(@D)
   @echo "" > $(IntermediateDirectory)/.d
   @echo $(Objects0)  > $(ObjectsFileList)
   $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions)

MakeIntermediateDirs:
   @$(MakeDirCommand) "./Debug"


$(IntermediateDirectory)/.d:
   @$(MakeDirCommand) "./Debug"

PreBuild:


##
## Objects
##
$(IntermediateDirectory)/tiempo.cpp$(ObjectSuffix): tiempo.cpp $(IntermediateDirectory)/tiempo.cpp$(DependSuffix)
   $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Guillermo/Desktop/trabajos/ModTiempo/tiempo.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/tiempo.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/tiempo.cpp$(DependSuffix): tiempo.cpp
   @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/tiempo.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/tiempo.cpp$(DependSuffix) -MM "tiempo.cpp"

$(IntermediateDirectory)/tiempo.cpp$(PreprocessSuffix): tiempo.cpp
   @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/tiempo.cpp$(PreprocessSuffix) "tiempo.cpp"


-include $(IntermediateDirectory)/*$(DependSuffix)
##
## Clean
##
clean:
   $(RM) -r ./Debug/


23  Programación / Programación C/C++ / Re: Error: Unvalid reference to en: 29 Noviembre 2015, 21:20 pm
Perdona no me había enterado bien antes, no me aparece tiempo.o creo que no se ha llegado a compilar. Paso la compilacion hasta el error aqui: https://gyazo.com/223ee8af50bcadacdffce56e4e4dca83, ¿Qué es lo que puede ocurrir entonces? se compila antes la biblioteca que contiene a la otra??
Esta es toda la compilacion:
C:\Windows\system32\cmd.exe /C mingw32-make.exe -j 8 -e -f  Makefile
"----------Building project:[ ModHerramientas - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/Guillermo/Desktop/trabajos/ModHerramientas'
mingw32-make.exe[1]: Leaving directory 'C:/Users/Guillermo/Desktop/trabajos/ModHerramientas'
mingw32-make.exe[1]: Entering directory 'C:/Users/Guillermo/Desktop/trabajos/ModHerramientas'
g++  -c  "C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp" -g -O0 -Wall  -o ./Debug/herramientas.cpp.o -I. -I.
g++ -o ./Debug/ModHerramientas @"ModHerramientas.txt" -L.
./Debug/herramientas.cpp.o: In function `ordenar(Tiempo*, int)':
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:21: undefined reference to `esMenor(Tiempo, Tiempo)'
./Debug/herramientas.cpp.o: In function `mostrar(Tiempo)':
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:40: undefined reference to `hora(Tiempo)'
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:40: undefined reference to `hora(Tiempo)'
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:41: undefined reference to `milesima(Tiempo)'
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:41: undefined reference to `segundo(Tiempo)'
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:41: undefined reference to `minuto(Tiempo)'
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:41: undefined reference to `hora(Tiempo)'
./Debug/herramientas.cpp.o: In function `mostrar(Tiempo const*, int)':
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:57: undefined reference to `hora(Tiempo)'
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:57: undefined reference to `hora(Tiempo)'
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:58: undefined reference to `milesima(Tiempo)'
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:58: undefined reference to `segundo(Tiempo)'
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:58: undefined reference to `minuto(Tiempo)'
C:/Users/Guillermo/Desktop/trabajos/ModHerramientas/herramientas.cpp:58: undefined reference to `hora(Tiempo)'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/ModHerramientas] Error 1
mingw32-make.exe: *** [All] Error 2
ModHerramientas.mk:78: recipe for target 'Debug/ModHerramientas' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/Guillermo/Desktop/trabajos/ModHerramientas'
Makefile:4: recipe for target 'All' failed
====13 errors, 0 warnings====
24  Programación / Programación C/C++ / Re: Error: Unvalid reference to en: 29 Noviembre 2015, 20:56 pm
Creo que es porque no inicializo ningun valor.
25  Programación / Programación C/C++ / Re: Error: Unvalid reference to en: 29 Noviembre 2015, 20:47 pm
Y aquí todos los errores del codigo:
https://gyazo.com/aa039937548ff7355e5262ef0e087e11
26  Programación / Programación C/C++ / Re: Error: Unvalid reference to en: 29 Noviembre 2015, 20:45 pm
Este sería el módulo de biblioteca tiempo.
Código
  1. #include "tiempo.h"
  2. #include <iostream>
  3. using namespace std;
  4. Tiempo definir(int seg){
  5.    int h=seg/3600;
  6.    int minutos=seg%3600;
  7.    int segundos=(seg%3600)%60;
  8.    Tiempo t={h,minutos,segundos};
  9.    return t;
  10. }
  11. /*
  12.  * Pre: seg >= 0, mil_seg >= 0 y mil_seg <= 999
  13.  * Post: Devuelve una medida de tiempo de seg segundos y mil_seg milesimas
  14.  *       de segundo
  15.  */
  16.  
  17. Tiempo definir(int seg, int mil_seg){
  18. int h=seg/3600;
  19.    int min=seg%3600;
  20.    int segundos=(seg%3600)%60;
  21. int milesimas= mil_seg;
  22.    Tiempo t={h,min,segundos,milesimas};
  23. return t;
  24. }
  25.  
  26. /****************************************************************************
  27.  *  Funciones para conocer la descomposición de un dato de tipo Tiempo
  28.  *  en horas, minutos, segundos y milésimas de segundo
  29.  ****************************************************************************/
  30.  
  31. /*
  32.  * Pre: t define una medida de tiempo no negativa con precisión de una milésima
  33.  *      de segundo.
  34.  *      Podemos imaginar a t equivalente a <h:m:s:mil>, donde h son horas (igual
  35.  *      o mayor que 0), m son minutos (entre 0 y 59), s son segundos (entre 0 y
  36.  *      59) y mil son milésimas de segundo (entre 0 y 999)
  37.  * Post: Devuelve el número de horas h de la medida de tiempo t
  38.  */
  39. int hora (Tiempo t){
  40. return t.horas;
  41. }
  42.  
  43. /*
  44.  * Pre: t define una medida de tiempo no negativa con precisión de una milésima
  45.  *      de segundo.
  46.  *      Podemos imaginar a t equivalente a <h:m:s:mil>, donde h son horas (igual
  47.  *      o mayor que 0), m son minutos (entre 0 y 59), s son segundos (entre 0 y
  48.  *      59) y mil son milésimas de segundo (entre 0 y 999)
  49.  * Post: Devuelve el número de minutos m de la medida de tiempo t
  50.  */
  51. int minuto (Tiempo t){
  52. return t.minutos;
  53. }
  54. /*
  55.  * Pre: t define una medida de tiempo no negativa con precisión de una milésima
  56.  *      de segundo.
  57.  *      Podemos imaginar a t equivalente a <h:m:s:mil>, donde h son horas (igual
  58.  *      o mayor que 0), m son minutos (entre 0 y 59), s son segundos (entre 0 y
  59.  *      59) y mil son milésimas de segundo (entre 0 y 999)
  60.  * Post: Devuelve el número de segundos s de la medida de tiempo t
  61.  */
  62. int segundo (Tiempo t){
  63. return t.seg;
  64. }
  65.  
  66. /*
  67.  * Pre: t define una medida de tiempo no negativa con precisión de una milésima
  68.  *      de segundo.
  69.  *      Podemos imaginar a t equivalente a <h:m:s:mil>, donde h son horas (igual
  70.  *      o mayor que 0), m son minutos (entre 0 y 59), s son segundos (entre 0 y
  71.  *      59) y mil son milésimas de segundo (entre 0 y 999)
  72.  * Post: Devuelve el número de milésimas de segundos mil de la medida de tiempo t
  73.  */
  74. int milesima (Tiempo t){
  75. return t.mil_seg;
  76. }
  77.  
  78. /****************************************************************************
  79.  *  Funciones para comparar dos datos de tipo Tiempo
  80.  ****************************************************************************/
  81.  
  82. /*
  83.  * Pre: t1 y t2 definen dos medidas de tiempo con precisión de una milésima
  84.  *      de segundo, iguales o superiores a 0 milésimas de segundo
  85.  * Post: Devuelve true si y sólo si el tiempo t1 es más corto que el tiempo t2
  86.  */
  87. bool esMenor (Tiempo t1, Tiempo t2){
  88. if(t1.horas<t2.horas){
  89. return t1.horas<t2.horas;
  90. }
  91. else if(t1.horas==t2.horas && t1.minutos<t2.minutos){
  92. return t1.minutos<t2.minutos;
  93. }
  94. else if(t1.minutos<t2.minutos && t1.seg<t2.seg){
  95. return t1.seg<t2.seg;
  96. }
  97. else if(t1.segundos==t2.segundos && t1.mil_seg<t2.mil_seg){
  98. return t1.mil_seg<t2.mil_seg;
  99. }
  100. else{
  101. return false;
  102. }
  103. }
  104.  
  105. /*
  106.  * Pre: t1 y t2 definen dos medidas de tiempo con precisión de una milésima
  107.  *      de segundo, iguales o superiores a 0 milésimas de segundo
  108.  * Post: Devuelve true si y sólo si el tiempo t1 es más largo que el tiempo t2
  109.  */
  110. bool esMayor (Tiempo t1, Tiempo t2){
  111. if(t1.horas>t2.horas){
  112. return t1.horas>t2.horas;
  113. }
  114. else if(t1.horas==t2.horas && t1.minutos>t2.minutos){
  115. return t1.minutos>t2.minutos;
  116. }
  117. else if(t1.minutos>t2.minutos && t1.seg>t2.seg){
  118. return t1.seg>t2.seg;
  119. }
  120. else if(t1.segundos==t2.segundos && t1.mil_seg>t2.mil_seg){
  121. return t1.mil_seg>t2.mil_seg;
  122. }
  123. else{
  124. return false;
  125. }
  126. }
  127. /*
  128.  * Pre: t1 y t2 definen dos medidas de tiempo con precisión de una milésima
  129.  *      de segundo, iguales o superiores a 0 milésimas de segundo
  130.  * Post: Devuelve true si y sólo el valor del tiempo t1 es igual al del
  131.  *       tiempo t2
  132.  */
  133. bool sonIguales (Tiempo t1, Tiempo t2){
  134. if(t1.horas==t2.horas && t1.minutos==t2.minutos && t1.seg==t2.seg && t1.mil_seg==t2.mil_seg){
  135. return t1.horas==t2.horas;
  136. }
  137. else{
  138. return false;
  139. }
  140. }
  141.  
  142. /****************************************************************************
  143.  * Funciones para operar aritméticamente con un par de datos de tipo Tiempo
  144.  ****************************************************************************/
  145.  
  146. /*
  147.  * Pre: t1 y t2 definen dos medidas de tiempo con precisión de una milésima
  148.  *      de segundo, iguales o superiores a 0 milésimas de segundo.
  149.  * Post: Devuelve un tiempo igual a la suma de los tiempos t1 y t2
  150.  */
  151. Tiempo sumar (Tiempo t1, Tiempo t2){
  152. t1=t1.horas*3600+t1.minutos*60+t1.seg+(double)t1.mil_seg/1000;
  153. t2=t2.horas*3600+t2.minutos*60+t2.seg+(double)t2.mil_seg/1000;
  154. return t1+t2;
  155. }
  156.  
  157. /*
  158.  * Pre: t1 y t2 definen dos medidas de tiempo con precisión de una milésima
  159.  *      de segundo, iguales o superiores a 0 milésimas de segundo. El valor
  160.  *      de t1 es igual o superior al de t2.
  161.  * Post: Devuelve un tiempo igual a la diferencia del tiempo t1 menos el
  162.  *       tiempo t2
  163.  */
  164. Tiempo restar (Tiempo t1, Tiempo t2){
  165. t1=t1.horas*3600+t1.minutos*60+t1.seg+(double)t1.mil_seg/1000;
  166. t2=t2.horas*3600+t2.minutos*60+t2.seg+(double)t2.mil_seg/1000;
  167. return t1-t2;
  168. }
  169.  
  170.  

Implemento esta función en otra biblioteca y aquí me salta el error:
Código
  1. #include <iostream>
  2. #include <iomanip>
  3. #include "../ModTiempo/tiempo.h"
  4. using namespace std;
  5. /*
  6.  * Pre: n >= 0 y T[0,n-1] almacena los valores de n medidas de tiempo.
  7.  * Post: Los valores de T[0,n-1] han sido permutados de forma que ahora
  8.  *       se encuentran ordenados según medidas de tiempo de duración
  9.  *       igual o creciente. Es decir, el tiempo T[0] es igual o menor
  10.  *       que el tiempo T[1], ..., y el tiempo T[n-2] es menor o igual
  11.  *       que el tiempo T[n-1]
  12.  */
  13. void ordenar(Tiempo T[], const int n){
  14. for(int i=0;i<n;i++){
  15. int menor=i;
  16. for(int j=i+1;j<n;j++){
  17. if(esMenor(T[j],T[menor])){
  18. menor=j;
  19. }
  20. }
  21. Tiempo aux=T[i];
  22. T[i]=T[menor];T[menor]=aux;
  23. }
  24. }
  25.  
  26. /*
  27.  * Pre: El tiempo t es inferior a 100 horas
  28.  * Post: Escribe por pantalla una secuencia de 12 caracteres (y sin
  29.  *       acabar la línea) en la que presenta el tiempo definido por t
  30.  *       con el siguiente formato:
  31.  *       hh:mm:ss,mmm
  32.  *       Un ejemplo:
  33.  *       07:30:00,055
  34.  */
  35. void mostrar (const Tiempo t){
  36. if(hora(t)>=0 && hora(t)<=100){
  37. cout<<setw(2)<<hora(t)<< ':'<<setw(2)<<setfill('0')<<minuto(t)<<':'<<setw(2)<<setfill('0')<<segundo(t)<<','<<setw(3)<<setfill('0')<<milesima(t);
  38. }
  39. }
  40.  
  41. /*
  42.  * Pre: Los tiempos almacenados en T[0,n-1] son inferiores a 100 horas
  43.  * Post: Escribe por pantalla n líneas en las que presenta los valores de
  44.  *       los tiempos almacenados en T[0,n-1] con el siguiente formato  
  45.  *       (cadauno de los tiempos ocupa 12 caracteres):
  46.  *       01. 03:12:00,500
  47.  *       02. 12:45;30,000
  48.  *       03. 00:01:00,450
  49.  *            ....
  50.  */
  51. void mostrar (const Tiempo T[], const int n){
  52. {
  53. if(hora(t)>=0 && hora(t)<=100){
  54. for(int i=0;i<n;i++){
  55. cout<<setw(2)<<hora(t)<< ':'<<setw(2)<<setfill('0')<<minuto(t)<<':'<<setw(2)<<setfill('0')<<segundo(t)<<','<<setw(3)<<setfill('0')<<milesima(t);
  56.  
  57. }
  58. }
  59. }
  60.  
  61.  
27  Programación / Programación C/C++ / Re: Error: Unvalid reference to en: 29 Noviembre 2015, 20:43 pm
Ahora pego todas las bibliotecas
28  Programación / Programación C/C++ / Re: Error: Unvalid reference to en: 29 Noviembre 2015, 20:42 pm
Si. la funcion esMenor esta en la misma biblioteca que la estructura Tiempo y esta incluida en ella. En la main hago referencia #include <../ModTiempo/tiempo.h>
29  Programación / Programación C/C++ / Error: Unvalid reference to en: 29 Noviembre 2015, 20:28 pm
Os paso la captura con el error que me sale:https://gyazo.com/dbe2919a54ef1ecaf995aa200af65bd6
Quiero utilizar una funcion de la estructura Tiempo que he creado yo en una biblioteca aparte y me sale que no le hago referencia, no se que debería hacer. Saludos y gracias.
30  Programación / Programación C/C++ / Re: Duda con algoritmo secuencial usando booleanos en: 21 Noviembre 2015, 12:58 pm
Vale ya lo tengo mas claro, muchas gracias while(!encontrado) se inicializa como true entonces cuando encontrado=true, !encontrado es false y el bucle se para, muchas gracias!!
Páginas: 1 2 [3] 4 5
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines