Retroceder   Foros del Web > Temas generales de computación > Programación > C/C++

Respuesta
 
Herramientas Desplegado
Antiguo 21-abr-2008, 08:13   #1 (permalink)
ARAPSPGON ha deshabilitado el karma
 
Fecha de Ingreso: octubre-2007
Mensajes: 33
Netbeans y C++ duda pausar un programa

Hola muy buenas.
tengo una pequeña duda que no consigo solventar
Uso para compilar y programar C/C++ , Cygwin y Neatbeans como IDE

he hecho un simple saludo inicial que al compilarlo no me da ningun problema dentro del IDE y puedo ver el resultado bien.
pero al ejecutar el ejecutable EXE del programa compilado fuera del IDE pues la pausa no la hace para ver el Saludo y se cierra el programa una vez ejecutado. lo he probado todo y no se porque pasa eso.

her probado con system pause y con cin.get y nada
puede ser por el make file o que hago mal?

helloworld.cc
Código PHP:
#include<iostream>
#include<cstdlib>

using namespace std;

int main()
{
    

    
cout << "Hello World";


    
system("PAUSE");
    
    return 
0
    
cin.get();

makefile
Código PHP:
#
#  There exist several targets which are by default empty and which can be 
#  used for execution of your targets. These targets are usually executed 
#  before and after some main targets. They are: 
#
#     .build-pre:              called before 'build' target
#     .build-post:             called after 'build' target
#     .clean-pre:              called before 'clean' target
#     .clean-post:             called after 'clean' target
#     .clobber-pre:            called before 'clobber' target
#     .clobber-post:           called after 'clobber' target
#     .all-pre:                called before 'all' target
#     .all-post:               called after 'all' target
#     .help-pre:                called before 'help' target
#     .help-post:               called after 'help' target
#
#  Targets beginning with '.' are not intended to be called on their own.
#
#  Main targets can be executed directly, and they are:
#  
#     build                    build a specific configuration
#     clean                    remove built files from a configuration
#     clobber                  remove all built files
#     all                      build all configurations
#     help                     print help mesage
#  
#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
#  .help-impl are implemented in nbproject/makefile-impl.mk.
#
# NOCDDL


# Environment 
MKDIR=mkdir
CP
=cp
CCADMIN
=CCadmin
RANLIB
=ranlib


# build
build: .build-pre .build-impl .build-post

.build-pre:
# Add your pre 'build' code here...

.build-post:
# Add your post 'build' code here...


# clean
clean: .clean-pre .clean-impl .clean-post

.clean-pre:
# Add your pre 'clean' code here...

.clean-post:
# Add your post 'clean' code here...


# clobber
clobber: .clobber-pre .clobber-impl .clobber-post

.clobber-pre:
# Add your pre 'clobber' code here...

.clobber-post:
# Add your post 'clobber' code here...


# all
all: .all-pre .all-impl .all-post

.all-pre:
# Add your pre 'all' code here...

.all-post:
# Add your post 'all' code here...


# help
help: .help-pre .help-impl .help-post

.help-pre:
# Add your pre 'help' code here...

.help-post:
# Add your post 'help' code here...



# include project implementation makefile
include nbproject/Makefile-impl.mk 
ARAPSPGON está desconectado   Responder Citando
Antiguo 23-abr-2008, 08:34   #2 (permalink)
Eternal Idol está en el buen camino
 
Avatar de Eternal Idol
 
Fecha de Ingreso: mayo-2004
Ubicación: Europa (VdL)
Mensajes: 5.058
Re: Netbeans y C++ duda pausar un programa

¿Probaste a ejecutarlo desde cmd.exe? (asumo que el cin.get no lo probaste despues del return como en el codigo de arriba).
Eternal Idol está desconectado   Responder Citando
Antiguo 24-abr-2008, 09:22   #3 (permalink)
ARAPSPGON ha deshabilitado el karma
 
Fecha de Ingreso: octubre-2007
Mensajes: 33
Re: Netbeans y C++ duda pausar un programa

con el cmd.exe tambien lo he probado y nada.

y el cin.get() tanto lo he probado antes como despues del return y nada

el exe que me genera visual c++ va de fabula pero en netbeans con cygwin la pausa se resiste como tambien alguna que otra libreria como la #include<conio.h>
ARAPSPGON está desconectado   Responder Citando
Antiguo 24-abr-2008, 10:57   #4 (permalink)
Eternal Idol está en el buen camino
 
Avatar de Eternal Idol
 
Fecha de Ingreso: mayo-2004
Ubicación: Europa (VdL)
Mensajes: 5.058
Re: Netbeans y C++ duda pausar un programa

Pero sin pausa igual ves el saludo ...

Si te parece que no esta funcionando bien depura el programa con el WinDbg de la Debugging Tools for Windows.
Eternal Idol está desconectado   Responder Citando
Antiguo 24-abr-2008, 15:14   #5 (permalink)
ARAPSPGON ha deshabilitado el karma
 
Fecha de Ingreso: octubre-2007
Mensajes: 33
Re: Netbeans y C++ duda pausar un programa

a ver el saludo lo veo pero immediatamente se cierra la ventana.

y probandolo en netbeans tambien

lo curioso es que cuando compilo y lo pruebo desde netbeans la ventana mantiene la pausa pero ejecutando el exe no
ARAPSPGON está desconectado   Responder Citando
Antiguo 28-abr-2008, 01:59   #6 (permalink)
Eternal Idol está en el buen camino
 
Avatar de Eternal Idol
 
Fecha de Ingreso: mayo-2004
Ubicación: Europa (VdL)
Mensajes: 5.058
Re: Netbeans y C++ duda pausar un programa

Depuralo o subi el ejecutable ...
Eternal Idol está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 00:25.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93